Skip to content

Commit

Permalink
Updated grunt for works with sass
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Sep 22, 2014
1 parent 53b69a8 commit 80c67ad
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ sftp-config.json
/node_modules/
/deploy/

# Sass
.sass-cache/

# OS X metadata
.DS_Store

Expand Down
52 changes: 22 additions & 30 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,6 @@ module.exports = function( grunt ) {
]
},

// Compile all .less files.
less: {
compile: {
options: {
// These paths are searched for @imports
paths: ['<%= dirs.css %>/']
},
files: [{
expand: true,
cwd: '<%= dirs.css %>/',
src: [
'*.less',
'!woocommerce-base.less',
'!mixins.less'
],
dest: '<%= dirs.css %>/',
ext: '.css'
}]
}
},

// Minify .js files.
uglify: {
options: {
Expand All @@ -73,7 +52,7 @@ module.exports = function( grunt ) {
'<%= dirs.js %>/admin/jquery.flot.pie.min.js': ['<%= dirs.js %>/admin/jquery.flot.pie.js'],
'<%= dirs.js %>/admin/jquery.flot.resize.min.js': ['<%= dirs.js %>/admin/jquery.flot.resize.js'],
'<%= dirs.js %>/admin/jquery.flot.stack.min.js': ['<%= dirs.js %>/admin/jquery.flot.stack.js'],
'<%= dirs.js %>/admin/jquery.flot.time.min.js': ['<%= dirs.js %>/admin/jquery.flot.time.js'],
'<%= dirs.js %>/admin/jquery.flot.time.min.js': ['<%= dirs.js %>/admin/jquery.flot.time.js']
}
},
frontend: {
Expand All @@ -87,7 +66,20 @@ module.exports = function( grunt ) {
dest: '<%= dirs.js %>/frontend/',
ext: '.min.js'
}]
},
}
},

// Compile all .scss files.
sass: {
compile: {
files: [{
expand: true,
cwd: '<%= dirs.css %>/',
src: ['*.scss'],
dest: '<%= dirs.css %>/',
ext: '.css'
}]
}
},

// Minify all .css files.
Expand All @@ -103,9 +95,9 @@ module.exports = function( grunt ) {

// Watch changes for assets.
watch: {
less: {
files: ['<%= dirs.css %>/*.less'],
tasks: ['less', 'cssmin']
css: {
files: ['<%= dirs.css %>/*.scss'],
tasks: ['sass', 'cssmin']
},
js: {
files: [
Expand Down Expand Up @@ -197,7 +189,7 @@ module.exports = function( grunt ) {
apigen: {
command: [
'cd apigen/',
'php apigen.php --source ../ --destination ../wc-apidocs --download yes --template-config ./templates/woodocs/config.neon --title "WooCommerce" --exclude "*/mijireh/*" --exclude "*/includes/libraries/*" --exclude "*/api/*" --exclude "*/i18n/*" --exclude "*/node_modules/*" --exclude "*/deploy/*" --exclude "*/apigen/*" --exclude "*/wc-apidocs/*"',
'php apigen.php --source ../ --destination ../wc-apidocs --download yes --template-config ./templates/woodocs/config.neon --title "WooCommerce" --exclude "*/mijireh/*" --exclude "*/includes/libraries/*" --exclude "*/api/*" --exclude "*/i18n/*" --exclude "*/node_modules/*" --exclude "*/deploy/*" --exclude "*/apigen/*" --exclude "*/wc-apidocs/*"'
].join( '&&' )
}
},
Expand Down Expand Up @@ -238,9 +230,9 @@ module.exports = function( grunt ) {
// Load NPM tasks to be used here
grunt.loadNpmTasks( 'grunt-shell' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-less' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-sass' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
Expand All @@ -249,7 +241,7 @@ module.exports = function( grunt ) {

// Register tasks
grunt.registerTask( 'default', [
'less',
'sass',
'cssmin',
'uglify'
]);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-cssmin": "~0.10.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-less": "~0.11.4",
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-shell": "^1.1.1",
"grunt-wp-i18n": "^0.4.8"
"grunt-wp-i18n": "^0.4.8",
"grunt-contrib-sass": "^0.8.1"
},
"engines": {
"node": ">=0.8.0",
Expand Down

0 comments on commit 80c67ad

Please sign in to comment.