Swap out grunt, add in browserify
This commit is contained in:
parent
b1b42679ab
commit
358997dfcd
96
Gruntfile.js
96
Gruntfile.js
|
@ -1,96 +0,0 @@
|
|||
module.exports = function(grunt) {
|
||||
|
||||
// Add your script files here in order of precedence
|
||||
|
||||
var scripts = [
|
||||
'js/script.js'
|
||||
];
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
autoprefixer: {
|
||||
single_file: {
|
||||
options: {
|
||||
browsers: ['last 2 versions', 'ie 8', 'ie 9']
|
||||
},
|
||||
files: { 'style.css': 'style.css' }
|
||||
}
|
||||
},
|
||||
imageoptim: {
|
||||
src: ['img/'],
|
||||
options: {
|
||||
quitAfter: true
|
||||
}
|
||||
},
|
||||
sass: {
|
||||
dist: {
|
||||
options: {
|
||||
outputStyle: 'compressed'
|
||||
},
|
||||
files: { 'style.css': 'scss/style.scss' }
|
||||
}
|
||||
},
|
||||
svgmin: {
|
||||
options: {
|
||||
plugins: [{
|
||||
removeViewBox: false
|
||||
}],
|
||||
},
|
||||
dist: {
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: 'img/',
|
||||
src: ['*.svg'],
|
||||
dest: 'img/',
|
||||
ext: '.svg'
|
||||
}],
|
||||
}
|
||||
},
|
||||
svg2png: {
|
||||
all: {
|
||||
files: [{
|
||||
src: ['img/*.svg'],
|
||||
dest: '.'
|
||||
}],
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
options: {
|
||||
mangle: false
|
||||
},
|
||||
all: {
|
||||
files: {
|
||||
'js/script.min.js': scripts
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
css: {
|
||||
files: ['scss/**/*.scss'],
|
||||
tasks: ['sass', 'autoprefixer'],
|
||||
options: {
|
||||
livereload: true
|
||||
}
|
||||
},
|
||||
js: {
|
||||
files: scripts,
|
||||
tasks: ['uglify'],
|
||||
options: {
|
||||
livereload: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-autoprefixer');
|
||||
grunt.loadNpmTasks('grunt-sass');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-imageoptim');
|
||||
grunt.loadNpmTasks('grunt-svg2png');
|
||||
grunt.loadNpmTasks('grunt-svgmin');
|
||||
|
||||
grunt.registerTask('img', ['svgmin', 'svg2png', 'imageoptim']);
|
||||
grunt.registerTask('default', ['sass', 'uglify', 'watch']);
|
||||
|
||||
};
|
48
package.json
48
package.json
|
@ -1,12 +1,44 @@
|
|||
{
|
||||
"name": "barebones",
|
||||
"description": "A lightweight, skeletal, responsive WordPress boilerplate theme for HTML5 and beyond.",
|
||||
"version": "2.0.0",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Benchmark",
|
||||
"email": "hello@benchmark.co.uk",
|
||||
"url": "http://www.benchmark.co.uk"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "benchmarkstudios/barebones"
|
||||
},
|
||||
"scripts": {
|
||||
"compile-sass": "node-sass --output-style=compressed assets/scss/barebones.scss style.css",
|
||||
"autoprefix-sass": "autoprefixer -b 'last 10 versions' --map style.css",
|
||||
"process-sass": "npm run compile-sass && npm run autoprefix-sass",
|
||||
"watch-sass": "fsmonitor -d 'assets/scss' -s '+*.scss' npm run process-sass",
|
||||
"browserify-js": "browserify assets/js/script.js -o js/script.min.js",
|
||||
"uglify-js": "uglifyjs js/script.min.js -o js/script.min.js -c",
|
||||
"process-js": "npm run browserify-js && npm run uglify-js",
|
||||
"watch-js": "fsmonitor -d 'assets/js' -s '+*.js' npm run process-js",
|
||||
"watch": "livereload & npm run watch-sass & npm run watch-js"
|
||||
},
|
||||
"browserify": {
|
||||
"transform": [
|
||||
"browserify-global-shim"
|
||||
]
|
||||
},
|
||||
"browserify-global-shim": {
|
||||
"jquery": "$"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-sass": "~0.17.0",
|
||||
"grunt-contrib-watch": "~0.6.1",
|
||||
"grunt-imageoptim": "~1.4.1",
|
||||
"grunt-svg2png": "~0.2.0",
|
||||
"grunt-svgmin": "~0.4.0",
|
||||
"grunt-contrib-uglify": "~0.5.0",
|
||||
"grunt-autoprefixer": "~0.8.2"
|
||||
"browserify": "~9.0.4",
|
||||
"browserify-shim": "~3.8.3",
|
||||
"uglify-js": "~2.4.19",
|
||||
"autoprefixer": "~5.1.0",
|
||||
"node-sass": "~2.1.1",
|
||||
"fsmonitor": "~0.2.4",
|
||||
"livereload": "~0.3.6",
|
||||
"browserify-global-shim": "~1.0.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue