Skip to content

deng-yc/postcss-cos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

使用


.foo{
    background:url('./images/test.png')
}

编译后

.foo{
    background:url('https://cdn.io/weapp/[hash]')
}

安装

npm install postcss-cos --save-dev

yarn add postcss-cos

###配置

postcss

postcss([
  require("postcss-cos")({
    domain: "http://cdn.io"  //自定义cdn域名,不写默认为cos地址
    secretId: 'AKxxxxxxxxxxxxxxxxxxxxxx',
    secretKey: 'xxxxxxxxxxxxxxxxxxxxxx',
    bucket: 'xxxx-125000000',
    region: 'ap-chengdu',
    path:""   //上传到cos的路径,默认为weapp
  })
]);

tarojs

weapp: {
    module: {
      postcss: {
        autoprefixer: {
          enable: true
        },
        "postcss-cos": {
          enable: true,
          config: {
            domain: "http://cdn.io"  //自定义cdn域名
            secretId: 'AKxxxxxxxxxxxxxxxxxxxxxx',
            secretKey: 'xxxxxxxxxxxxxxxxxxxxxx',
            bucket: 'xxxx-125000000',
            region: 'ap-chengdu',
            path:""   //上传到cos的路径,默认为weapp
          }
        }
      }
    }
  },

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published