1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
scripts: {
files: ['plugins/**/*.less', 'plugins/**/*.css'],
tasks: ['clean-pattern'],
options: {
spawn: false,
},
},
piwikjs: {
files: ['js/piwik.js'],
tasks: ["shell:compilePiwikJs"],
options: {
spawn: false,
},
}
},
"shell": {
compilePiwikJs: {
command: "sed '/<DEBUG>/,/<\\/DEBUG>/d' < piwik.js | sed 's/eval/replacedEvilString/' | java -jar yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar --type js --line-break 1000 | sed 's/replacedEvilString/eval/' | sed 's/^[/][*]/\\/*!/' > piwik-min.js && cp piwik-min.js ../piwik.js",
options: {
execOptions: {
cwd: 'js'
}
}
}
},
"clean-pattern": {
files: {path: "tmp/assets", pattern: /(.*).css/}
}
});
grunt.loadNpmTasks('clean-pattern');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-shell');
grunt.file.setBase('../../')
// Default task(s).
grunt.registerTask('default', ['watch']);
};
|