Created
June 1, 2017 00:56
-
-
Save jennifert/9037731119d3b7200bb17229822c4fb8 to your computer and use it in GitHub Desktop.
Current Grunt file for site resdesign
This file contains 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) { | |
'use strict'; | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
sass: { | |
dist: { | |
options: { | |
style: 'expanded', /**human readable */ | |
sourcemap: 'none', | |
}, | |
files: { | |
'css/style.css': 'sass/style.scss' | |
} | |
} | |
}, | |
csslint: { | |
strict: { | |
src: ['css/style.css'] | |
}, | |
lax: { | |
options: { | |
csslintrc: '.csslintrc' //just check for css errors that would stop code | |
}, | |
src: ['css/style.css'] | |
} | |
}, | |
concat: { | |
css: { | |
src: ['node_modules/normalize.css/normalize.css', 'css/style.css'], | |
dest: 'css/style.css' | |
} | |
}, | |
postcss: { | |
options: { | |
processors: [ | |
require('pixrem')(), | |
require('autoprefixer')({browsers: 'last 2 versions'}) | |
] | |
}, | |
dist: { | |
src: 'css/style.css', | |
dest: 'css/style.css' | |
} | |
}, | |
cssmin : { | |
css:{ | |
src: 'css/style.css', | |
dest: 'css/style.min.css' | |
} | |
}, | |
uglify: { | |
options: { | |
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n' | |
}, | |
build: { | |
files: { | |
'js/scripts.min.js': ['js/*.js', '!js/*.min.js'] | |
} | |
} | |
}, | |
jshint: { | |
files: ['Gruntfile.js', 'js/*.js', '!js/*.min.js'], | |
options: { | |
jshintrc: '.jshintrc', | |
ignores: '.jshintignore' | |
}, | |
}, | |
htmlmin: { // Task | |
dist: { // Target | |
options: { // Target options | |
removeComments: true, | |
collapseWhitespace: true | |
}, | |
files: [ | |
{ | |
expand: true, // Enable dynamic expansion. | |
cwd: 'src/', // Src matches are relative to this path. | |
src: ['**/*.html'], // Actual pattern(s) to match. | |
dest: 'dist/', // Destination path prefix. | |
}, | |
], | |
} | |
}, | |
imagemin: { | |
png: { | |
options: { | |
optimizationLevel: 7 | |
}, | |
files: [ | |
{ | |
expand: true, | |
cwd: 'img/', | |
src: ['**/*.png'], | |
dest: 'img/compressed/', | |
ext: '.png' | |
} | |
] | |
}, | |
jpg: { | |
options: { | |
progressive: true | |
}, | |
files: [ | |
{ | |
expand: true, | |
cwd: 'img/', | |
src: ['**/*.jpg'], | |
dest: 'img/compressed/', | |
ext: '.jpg' | |
} | |
] | |
} | |
}, | |
responsive_images: { | |
myTask: { | |
options: { | |
sizes: [{ | |
name: 'header-320', | |
width: 320 | |
}, | |
{ | |
name: 'header-640', | |
width: 640 | |
}, | |
{ | |
name: 'header-768', | |
width: 768 | |
}, | |
{ | |
name: 'header-1024', | |
width: 1024 | |
}, | |
{ | |
name: 'header-1366', | |
width: 1366 | |
}, | |
{ | |
name: 'header-1920', | |
width: 1920 | |
}, | |
{ | |
name: "header-2560", | |
width: 2560 | |
}] | |
}, | |
files: [{ | |
expand: true, | |
cwd: 'img/', | |
src: ['**.{jpg,gif,png}'], | |
dest: 'img/resize' | |
}] | |
} | |
}, | |
clean: { | |
build: { | |
src: [ 'build' ] | |
}, | |
stylesheets: { | |
src: [ 'build/**/*.css', '!build/application.css' ] | |
}, | |
scripts: { | |
src: [ 'build/**/*.js', '!build/application.js' ] | |
}, | |
images:{ | |
src: [ 'img/compressed/**/', 'img/resize/**/'] | |
} | |
}, | |
watch: { | |
gruntfile: { | |
files: 'Gruntfile.js', | |
tasks: ['jshint'], | |
}, | |
css: { | |
files: ['sass/*.scss'], | |
tasks: ['sass', 'csslint:lax', 'postcss', 'concat:css'] | |
}, | |
js: { | |
files: ['js/*.js','!js/*.min.js'], | |
tasks: ['jshint'/*,'concat:js','uglify'*/] | |
} | |
}, | |
copy: { | |
build: { | |
cwd: 'source', | |
src: [ '**' ], | |
dest: 'build', | |
expand: true | |
}, | |
} | |
}); //end grunt config | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-postcss'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-htmlmin'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-csslint'); | |
grunt.loadNpmTasks('grunt-contrib-cssmin'); | |
grunt.loadNpmTasks('grunt-contrib-imagemin'); | |
grunt.loadNpmTasks('grunt-responsive-images'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-clean'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.registerTask('images', ['clean:images', 'responsive_images','imagemin']); | |
grunt.registerTask('css', ['sass', 'csslint:lax', 'postcss','concat:css']); | |
grunt.registerTask('jscript', ['jshint']); | |
grunt.registerTask('dev', ['jscript', 'css','watch']); | |
grunt.registerTask('build', ['clean', 'copy']); | |
//grunt.registerTask('imagemin', ['imagemin']); | |
//grunt.registerTask('default', ['jshint','sass', 'csslint:lax','concat:css' ,'postcss', 'cssmin',/*'concat:js','uglify','watch']); | |
}; |
This file contains 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": "redesign", | |
"version": "1.0.0", | |
"description": "Website redesign for my Portfolio site", | |
"main": "index.html", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [ | |
"flex", | |
"portfolio" | |
], | |
"author": "Jennifer Tesolin", | |
"devDependencies": { | |
"autoprefixer": "^7.1.1", | |
"grunt": "^1.0.1", | |
"grunt-contrib-clean": "^1.1.0", | |
"grunt-contrib-concat": "^1.0.1", | |
"grunt-contrib-copy": "^1.0.0", | |
"grunt-contrib-csslint": "^2.0.0", | |
"grunt-contrib-cssmin": "^2.2.0", | |
"grunt-contrib-htmlmin": "^2.4.0", | |
"grunt-contrib-imagemin": "^1.0.1", | |
"grunt-contrib-jshint": "^1.1.0", | |
"grunt-contrib-sass": "^1.0.0", | |
"grunt-contrib-uglify": "^3.0.0", | |
"grunt-contrib-watch": "^1.0.0", | |
"grunt-postcss": "^0.8.0", | |
"grunt-responsive-images": "^1.10.1", | |
"normalize.css": "^7.0.0", | |
"pixrem": "^3.0.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is my current gruntfile for a site redesign, though not 100% finished. The site redesign start started being coded, so the builds and other production information is final.