我一直在努力将grunt整合到我在个人网站上所做的工作上.但是 - 它似乎不适合我当前的实现.简而言之,我使用的是静态站点生成器(Wintersmith).我的愿望是让grunt在站点生成器生成的这个目录上执行一系列操作(缩小css,uglify for js,格式化HTML并删除空行).
总之,这是我的问题:
我想在这种情况下使用grunt,但似乎我最好为这个任务编写一个shell脚本.
只需在src和中指定相同的路径即可dest.
是的你可以.请参阅动态构建文件对象
从文档复制的示例:
grunt.initConfig({
minify: {
dynamic_mappings: {
// Grunt will search for "**/*.js" under "lib/" when the "minify" task
// runs and build the appropriate src-dest file mappings then, so you
// don't need to update the Gruntfile when files are added or removed.
files: [
{
expand: true, // Enable dynamic expansion.
cwd: 'lib/' // Src matches are relative to this path.
src: ['**/*.js'], // Actual pattern(s) to match.
dest: 'build/', // Destination path prefix.
ext: '.min.js', // Dest filepaths will have this extension.
},
],
},
},
});
Run Code Online (Sandbox Code Playgroud)
这与Grunt 0.4有关
| 归档时间: |
|
| 查看次数: |
1385 次 |
| 最近记录: |