Last active
August 18, 2016 14:23
-
-
Save bob-moore/77b1de1e68187ff8f88b5a72fd292468 to your computer and use it in GitHub Desktop.
Grunt Configuration for Mpress w/ SCSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.loadNpmTasks('grunt-newer'); | |
grunt.loadNpmTasks('grunt-contrib-compass'); | |
grunt.loadNpmTasks('grunt-autoprefixer'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-clean'); | |
grunt.loadNpmTasks('grunt-openport'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.initConfig({ | |
// Reference package.json | |
pkg: grunt.file.readJSON('package.json'), | |
// Compile SCSS with the Compass Compiler | |
compass: { | |
dist: { | |
options: { | |
sassDir : 'styles', | |
cssDir : 'styles/temp', | |
outputStyle : 'compressed', | |
cacheDir : 'styles/.sass-cache', | |
sourcemap : true | |
} | |
} | |
}, | |
// Run Autoprefixer on compiled css | |
autoprefixer: { | |
options: { | |
browsers: ['last 3 version', '> 1%', 'ie 8', 'ie 9', 'ie 10'], | |
map: true | |
}, | |
admin : { | |
src : 'styles/temp/admin.css', | |
dest : 'styles/dist/admin.min.css' | |
}, | |
public : { | |
src : 'styles/temp/public.css', | |
dest : 'styles/dist/public.min.css' | |
} | |
}, | |
// Clean temp files | |
clean: { | |
temp_css: ['styles/temp/'], | |
}, | |
// JSHint - Check Javascript for errors | |
jshint: { | |
options: { | |
globals: { | |
jQuery: true | |
} | |
}, | |
admin : { | |
src: [ 'scripts/admin.js' ], | |
}, | |
public : { | |
src: [ 'scripts/public.js' ], | |
}, | |
}, | |
// Concat & Minify JS | |
uglify: { | |
options: { | |
sourceMap : true | |
}, | |
admin : { | |
files : { | |
'scripts/dist/admin.min.js' : [ 'scripts/admin.js' ] | |
} | |
}, | |
public : { | |
files : { | |
'scripts/dist/public.min.js' : [ 'scripts/public.js' ] | |
} | |
} | |
}, | |
// Watch | |
watch: { | |
options: { | |
livereload: true, | |
}, | |
livereload: { | |
files: ['styles/dist/*.css', 'scripts/dist/*.js', '*.html', 'images/*', '*.php'], | |
}, | |
cssPostProcess: { | |
files: 'styles/**/*.scss', | |
tasks: ['compass', 'newer:autoprefixer', 'clean'], | |
}, | |
jsPostProcess: { | |
files: [ 'scripts/**/*.js', '!scripts/dist/**/*.js', '!scripts/vendors/**/*.js' ], | |
tasks: ['newer:jshint', 'uglify'], | |
}, | |
}, | |
}); | |
grunt.registerTask('default', ['openport:watch.options.livereload:35729', 'watch']); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name" : "Mpress", | |
"description" : "Wordpress Starter Theme", | |
"license" : "GPL-2.0", | |
"version" : "1.0.0", | |
"repository" : { | |
"type" : "git", | |
"url" : "http://github.com/npm/npm.git" | |
}, | |
"devDependencies" : { | |
"grunt" : "latest", | |
"grunt-autoprefixer" : "latest", | |
"grunt-contrib-compass" : "latest", | |
"grunt-contrib-jshint" : "latest", | |
"grunt-contrib-uglify" : "latest", | |
"grunt-contrib-watch" : "latest", | |
"grunt-contrib-clean" : "latest", | |
"grunt-openport" : "latest", | |
"grunt-newer" : "latest" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment