Sha*_*tin 6 aurelia aurelia-cli
我们正在使用aurelia-cli.任务包括:
build.json
build.ts
process-css.ts
process-markup.ts
process-sass.ts
run.json
run.ts
test.json
test.ts
transpile.ts
Run Code Online (Sandbox Code Playgroud)
如果我们用cli做一个缓存破坏解决方案呢?
我们已经尝试将递增的数字scripts目录,因此,它去scripts1,scripts2,scriptsN.
Sha*_*tin 12
这是我的幸运日.8小时前的一个aurelia-cli版本说:
功能:支持捆绑修订号
首先,安装0.20.0并创建一个新的应用程序.
npm install aurelia-cli@">=0.20.0" -g
au new my-app
Run Code Online (Sandbox Code Playgroud)
或者,升级现有应用.
npm install aurelia-cli@">=0.20.0" --save-dev
Run Code Online (Sandbox Code Playgroud)
接下来,打开my-app/aurelia-project/aurelia.json.
将该build.options.rev属性设置为true.
"options": {
"minify": "stage & prod",
"sourcemaps": "dev & stage",
"rev": true
},
Run Code Online (Sandbox Code Playgroud)
在里面设置output和index属性build.targets
"targets": [
{
"id": "web",
"displayName": "Web",
"output": "scripts",
"index": "index.html"
}
],
Run Code Online (Sandbox Code Playgroud)
该aurelia-cli会寻找index文件,并替换引用scripts\vendor-bundle.js是这样的:
<script src="scripts\vendor-bundle.js" data-main="aurelia-bootstrapper">
<script src="scripts\vendor-bundle-947c308e28.js" data-main="aurelia-bootstrapper">
Run Code Online (Sandbox Code Playgroud)
最后,构建应用程序.
au build --env prod
Run Code Online (Sandbox Code Playgroud)
你的捆绑包看起来像这样:
app-bundle-e0c4d46f7d.js
vendor-bundle-dba9184d78.js
Run Code Online (Sandbox Code Playgroud)
let defaultBuildOptions = {
minify: "stage & prod",
sourcemaps: "dev & stage",
rev: false
};
Run Code Online (Sandbox Code Playgroud)
if (buildOptions.rev) {
//Generate a unique hash based off of the bundle contents
this.hash = generateHash(concat.content);
bundleFileName = generateHashedPath(this.config.name, this.hash);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1324 次 |
| 最近记录: |