Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

implements #340 Add support for CSS autoprefixer #392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions generators/app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ module.exports = function (grunt) {
},<% } %><% if (sassBootstrap) { %>
sass: {
files: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['sass:server']
tasks: ['sass:server', 'postcss']
},<% } %>
livereload: {
options: {
livereload: grunt.option('livereloadport') || LIVERELOAD_PORT
},
files: [
'<%%= yeoman.app %>/*.html',
'{.tmp,<%%= yeoman.app %>}/styles/{,*/}*.css',
'.tmp/styles/{,*/}*.css',
'{.tmp,<%%= yeoman.app %>}/scripts/{,*/}*.js',
'<%%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
'<%%= yeoman.app %>/scripts/templates/*.{ejs,mustache,hbs}',
Expand All @@ -79,6 +79,10 @@ module.exports = function (grunt) {
],
tasks: ['jst']
}<% } %>,
styles: {
files: ['<%%= yeoman.app %>/styles/{,*/}*.css'],
tasks: ['copy:styles', 'postcss']
},
test: {
files: ['<%%= yeoman.app %>/scripts/{,*/}*.js', 'test/spec/**/*.js'],
tasks: ['test:true']
Expand Down Expand Up @@ -132,6 +136,25 @@ module.exports = function (grunt) {
path: 'http://localhost:<%%= connect.test.options.port %>'
}
},
postcss: {
options: {
map: true,
processors: [
// Add vendor prefixed styles
require('autoprefixer')({
browsers: ['> 1%', 'last 2 versions', 'Firefox ESR']
})
]
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
clean: {
dist: ['.tmp', '<%%= yeoman.dist %>/*'],
server: '.tmp'
Expand Down Expand Up @@ -329,6 +352,15 @@ module.exports = function (grunt) {
}
},
copy: {
styles: {
files: [{
expand: true,
dot: true,
cwd: '<%%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}]
},
dist: {
files: [{
expand: true,
Expand Down Expand Up @@ -448,6 +480,7 @@ module.exports = function (grunt) {
<% if (sassBootstrap) { -%>
'sass:server',
<% } -%>
'postcss',
'connect:test',
'open:test',
'watch'
Expand All @@ -470,6 +503,7 @@ module.exports = function (grunt) {
<% if (sassBootstrap) { -%>
'sass:server',
<% } -%>
'postcss',
'connect:livereload',
'open:server',
'watch'
Expand All @@ -494,6 +528,7 @@ module.exports = function (grunt) {
<% if (sassBootstrap) { -%>
'sass',
<% } -%>
'postcss',
<% if(testFramework === 'mocha') { -%>
'connect:test',
'mocha'
Expand Down Expand Up @@ -527,6 +562,7 @@ module.exports = function (grunt) {
<% if (sassBootstrap) { -%>
'sass:dist',
<% } -%>
'postcss',
'useminPrepare',
'imagemin',
'htmlmin',
Expand Down
2 changes: 2 additions & 0 deletions generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"private": true,
"devDependencies": {
"apache-server-configs": "^2.8.0",
"autoprefixer": "^6.3.4",
"grunt": "^0.4.5",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-concat": "^0.5.0",
Expand Down Expand Up @@ -35,6 +36,7 @@
<% } -%>
"grunt-rev": "^0.1.0",
"grunt-open": "^0.2.3",
"grunt-postcss": "^0.8.0",
<% if (sassBootstrap) { -%>
"grunt-sass": "^1.0.0",
<% } -%>
Expand Down