-
Notifications
You must be signed in to change notification settings - Fork 7
/
Gruntfile.js
170 lines (158 loc) · 5.24 KB
/
Gruntfile.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// we could just concatenate everything, really
// but we like to have it the complex way.
// also, in this way we do not have to worry
// about putting files in the correct order
// (the dependency tree is walked by r.js)
less: {
dist: {
options: {
paths: [],
strictMath: false,
sourceMap: true,
outputSourceFiles: true,
sourceMapURL: '++theme++booster/less/booster-compiled.css.map',
sourceMapFilename: 'src/plonetheme/booster/theme/less/booster-compiled.css.map',
modifyVars: {
"isPlone": "false"
}
},
files: {
'src/plonetheme/booster/theme/styles/main.css': 'src/plonetheme/booster/theme/less/main.less'
}
}
},
watch: {
scripts: {
files: ['src/plonetheme/booster/theme/scripts/**/*.js'],
tasks: ['jshint', 'uglify']
},
stylesheets: {
files: ['src/plonetheme/booster/theme/**/*.css', 'src/plonetheme/booster/theme/**/*.less'],
tasks: ['less']
},
// html:{
// files: ['src/plonetheme/booster/theme/index.html'],
// tasks: ['htmlmin']
// },
},
browserSync: {
html: {
bsFiles: {
src : ['src/plonetheme/booster/theme/less/*.less']
},
options: {
watchTask: true,
debugInfo: true,
server: {
baseDir: "."
}
}
},
plone: {
bsFiles: {
src : ['src/plonetheme/booster/theme/less/*.less']
},
options: {
watchTask: true,
debugInfo: true,
proxy: "localhost:8080"
}
}
},
jshint: {
options: {
reporter: require('jshint-stylish'),
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
globals: {
jQuery: true
},
},
build: ['Gruntfile.js', 'src/plonetheme/booster/theme/scripts/**/*.js']
},
uglify: {
options: {
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n'
},
build: {
files: {
'dist/theme/scripts/main.js': 'src/plonetheme/booster/theme/scripts/**/*.js'
}
}
},
cssmin: {
options: {
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n'
},
build: {
files: {
'dist/theme/styles/main.css': 'src/plonetheme/booster/theme/styles/main.css'
}
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'dist/theme/index.html': 'src/plonetheme/booster/theme/index.html',
}
},
},
copy: {
dist: {
files: [
{
expand: true,
flatten: true,
src: ['src/plonetheme/booster/theme/*'],
dest: 'dist/theme/', filter: 'isFile'
},
{
expand: true,
cwd: 'src/plonetheme/booster/theme/',
src: ['images/**', 'views/**', 'template-overrides/**'],
dest: 'dist/theme/'
},
],
},
},
// make a zipfile
compress: {
dist: {
options: {
archive: 'plonetheme.booster.zip'
},
files: [
{
expand: true,
cwd: 'dist/',
src: ['theme/**'],
dest: '', filter: 'isFile'},
]
}
},
});
// grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['watch']);
grunt.registerTask('bsync', ["browserSync:html", "watch"]);
grunt.registerTask('plone-bsync', ["browserSync:plone", "watch"]);
grunt.registerTask('dist', ['copy', 'jshint', 'uglify', 'cssmin', 'less', 'compress']);
};