保持点分隔文件 grunt-babel
keep dot separated file grunt-babel
我正在使用 grunt-babel 将 ES6 转换为 ES5。我的文件名之一是 app.collection.js,在 运行 任务之后,将文件重命名为 app.js 。
什么是 babel option 来解决这个问题。
/****************************************************************************
* Grunt Babel Compile ES6 to ES5
****************************************************************************/
babel: {
options: {
blacklist: ['strict'],
comments: true,
loose: ["es6.classes", "es6.properties.computed"],
"ignore": [
]
},
dist: {
files: [{ // Dictionary of files
expand: true,
cwd: '<%= config.path.app.js %>',
src: ['**/**/*.js'],
dest: '<%= config.path.app.js %>',
ext: '.js'
}]
}
}
您可以完全删除 ext
属性 或添加 extDot
属性 并将值放在最后以保留 app.collection.js
名称。
files: [{ // Dictionary of files
expand: true,
cwd: '<%= config.path.app.js %>',
src: ['**/**/*.js'],
dest: '<%= config.path.app.js %>',
ext: '.js',
extDot: 'last'
}]
在 Building the files object dynamically @ gruntjs.com
查看更多
extDot
Used to indicate where the period indicating the extension is located. Can take either 'first' (extension begins after the first period in the file name) or 'last' (extension begins after the last period), and is set by default to 'first' [Added in 0.4.3]
我正在使用 grunt-babel 将 ES6 转换为 ES5。我的文件名之一是 app.collection.js,在 运行 任务之后,将文件重命名为 app.js 。
什么是 babel option 来解决这个问题。
/****************************************************************************
* Grunt Babel Compile ES6 to ES5
****************************************************************************/
babel: {
options: {
blacklist: ['strict'],
comments: true,
loose: ["es6.classes", "es6.properties.computed"],
"ignore": [
]
},
dist: {
files: [{ // Dictionary of files
expand: true,
cwd: '<%= config.path.app.js %>',
src: ['**/**/*.js'],
dest: '<%= config.path.app.js %>',
ext: '.js'
}]
}
}
您可以完全删除 ext
属性 或添加 extDot
属性 并将值放在最后以保留 app.collection.js
名称。
files: [{ // Dictionary of files
expand: true,
cwd: '<%= config.path.app.js %>',
src: ['**/**/*.js'],
dest: '<%= config.path.app.js %>',
ext: '.js',
extDot: 'last'
}]
在 Building the files object dynamically @ gruntjs.com
查看更多
extDot
Used to indicate where the period indicating the extension is located. Can take either 'first' (extension begins after the first period in the file name) or 'last' (extension begins after the last period), and is set by default to 'first' [Added in 0.4.3]