Giter VIP home page Giter VIP logo

vue-cli-plugin-ali-oss's Introduction

简介

  • 实现web项目打包后自动上传阿里云oss
  • 搭配自动tinypng图片压缩插件vue-tinypng-plugin效果更佳

使用说明

配置

1.创建 oss.js(优先级最高)

路径: {你的项目目录下}/oss.js

oss.js:

module.exports = {
	accessKeyId: "xxx",
	accessKeySecret: "xxx",
	bucket: "bucket",
	prefix: "prefix",
	projectName: true,
};

2.或者在插件初始化写入配置(优先级中)

  • 注意!!! 1.0.3版本之后需要包含在config里
new tinypngPlugin({
	config:{
		accessKeyId: "xxx",
		accessKeySecret: "xxx",
		bucket: "bucket",
		prefix: "prefix",
		projectName: true,
	}
})

引入

configureWebpack: (config) => {
    return {
        plugins: [
            new aliOssPlugin()
        ]
    }
}

路径顺序

https://${bucket}.${region}.aliyuncs.com/${prefix}/${projectName}/XXXX

配置属性

accessKeyId

阿里云accessKeyId

accessKeyId:XXX,

accessKeySecret

阿里云accessKeySecret

accessKeySecret:XXX,

bucket

bucket名称

bucket:XXX,

timeout

超时时间 默认:15 * 1000

timeout:XXX,

secure

是否https 默认:true

secure:XXX,

region

阿里oss-region 默认:"oss-cn-hangzhou"

region:XXX,

prefix

路径前缀名称

prefix:XXX,

projectName

是否使用项目名称在路径中 默认:true

projectName:XXX,

use

是否使用该插件 default: true

use: true/false,

reg

可识别的正则 默认: /.(png|jpe?g|bmp|gif|mp4|webm|mp3)/i

reg: XXXX

其他示例

vue-cli-plugin-ali-oss's People

Contributors

laxnogithub avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.