Skip to content

Commit c4dfd61

Browse files
committed
feat(build): add autoprefixer support
Add support for SASS and vanilla CSS to get automatic vendor prefixes base on the browsers selected in the Gruntfile. Closes #317
1 parent bf17e34 commit c4dfd61

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

app/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Generator.prototype.bootstrapFiles = function bootstrapFiles() {
158158
sourceFileList: files.map(function (file) {
159159
return 'styles/' + file.replace('.scss', '.css');
160160
}),
161-
searchPath: ['.tmp', 'app']
161+
searchPath: '.tmp'
162162
});
163163
};
164164

templates/common/Gruntfile.js

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,35 @@ module.exports = function (grunt) {
3939
},<% if (compassBootstrap) { %>
4040
compass: {
4141
files: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
42-
tasks: ['compass:server']
42+
tasks: ['compass:server', 'autoprefixer']
4343
},<% } %>
44+
styles: {
45+
files: ['<%%= yeoman.app %>/styles/{,*/}*.css'],
46+
tasks: ['copy:styles', 'autoprefixer']
47+
},
4448
livereload: {
4549
options: {
4650
livereload: LIVERELOAD_PORT
4751
},
4852
files: [
4953
'<%%= yeoman.app %>/{,*/}*.html',
50-
'{.tmp,<%%= yeoman.app %>}/styles/{,*/}*.css',
54+
'.tmp/styles/{,*/}*.css',
5155
'{.tmp,<%%= yeoman.app %>}/scripts/{,*/}*.js',
5256
'<%%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
5357
]
5458
}
5559
},
60+
autoprefixer: {
61+
options: ['last 1 version'],
62+
dist: {
63+
files: [{
64+
expand: true,
65+
cwd: '.tmp/styles/',
66+
src: '{,*/}*.css',
67+
dest: '.tmp/styles/'
68+
}]
69+
}
70+
},
5671
connect: {
5772
options: {
5873
port: 9000,
@@ -269,20 +284,29 @@ module.exports = function (grunt) {
269284
'generated/*'
270285
]
271286
}]
287+
},
288+
styles: {
289+
expand: true,
290+
cwd: '<%%= yeoman.app %>/styles',
291+
dest: '.tmp/styles/',
292+
src: '{,*/}*.css'
272293
}
273294
},
274295
concurrent: {
275296
server: [
276-
'coffee:dist'<% if (compassBootstrap) { %>,
277-
'compass:server'<% } %>
297+
'coffee:dist',<% if (compassBootstrap) { %>
298+
'compass:server',<% } %>
299+
'copy:styles'
278300
],
279301
test: [
280-
'coffee'<% if (compassBootstrap) { %>,
281-
'compass'<% } %>
302+
'coffee',<% if (compassBootstrap) { %>
303+
'compass',<% } %>
304+
'copy:styles'
282305
],
283306
dist: [
284307
'coffee',<% if (compassBootstrap) { %>
285308
'compass:dist',<% } %>
309+
'copy:styles',
286310
'imagemin',
287311
'svgmin',
288312
'htmlmin'
@@ -328,6 +352,7 @@ module.exports = function (grunt) {
328352
grunt.task.run([
329353
'clean:server',
330354
'concurrent:server',
355+
'autoprefixer',
331356
'connect:livereload',
332357
'open',
333358
'watch'
@@ -337,6 +362,7 @@ module.exports = function (grunt) {
337362
grunt.registerTask('test', [
338363
'clean:server',
339364
'concurrent:test',
365+
'autoprefixer',
340366
'connect:test',
341367
'karma'
342368
]);
@@ -345,8 +371,9 @@ module.exports = function (grunt) {
345371
'clean:dist',
346372
'useminPrepare',
347373
'concurrent:dist',
374+
'autoprefixer',
348375
'concat',
349-
'copy',
376+
'copy:dist',
350377
'cdnify',
351378
'ngmin',
352379
'cssmin',

templates/common/_package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"grunt-contrib-htmlmin": "~0.1.3",
1717
"grunt-contrib-imagemin": "~0.2.0",
1818
"grunt-contrib-watch": "~0.5.2",
19+
"grunt-autoprefixer": "~0.2.0",
1920
"grunt-usemin": "~0.1.11",
2021
"grunt-svgmin": "~0.2.0",
2122
"grunt-rev": "~0.1.0",

0 commit comments

Comments
 (0)