Created
June 25, 2015 14:12
-
-
Save jonbretman/d65730b9b071651e8f72 to your computer and use it in GitHub Desktop.
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) { | |
grunt.initConfig({ | |
jshint: { | |
options: { | |
debug: grunt.option('js-debug') === true, | |
undef: true, | |
unused: 'var', | |
browser: true, | |
predef: [ | |
'require', | |
'define', | |
'requestAnimationFrame', | |
'console', | |
'Promise', | |
'fetch', | |
'Headers' | |
] | |
}, | |
checkout: { | |
files: [ | |
{ | |
expand: true, | |
src: [ | |
'static-source/checkout/js/**/*.js', | |
'!static-source/checkout/js/lib/**/*.js', | |
'!static-source/checkout/js/polyfills/**/*.js', | |
'!static-source/checkout/js/embedded/**/*.js' | |
] | |
} | |
] | |
} | |
}, | |
less: { | |
options: { | |
ieCompat: false, | |
compress: grunt.option('minify-css') === true | |
}, | |
checkout: { | |
files: [ | |
{ | |
expand: true, | |
cwd: 'static-source/checkout/', | |
src: [ | |
'lyst.less', | |
'nojs-fonts.less', | |
'inline-res.less', | |
'checkout.less' | |
], | |
dest: 'static-build/checkout/', | |
ext: '.css' | |
} | |
] | |
} | |
}, | |
postcss: { | |
options: { | |
processors: [ | |
require('autoprefixer-core')({browsers: ['last 2 versions', 'IE >= 9']}).postcss, | |
require('css-mqpacker').postcss | |
] | |
}, | |
web: { | |
files: [{ | |
expand: true, | |
cwd: 'static-build/checkout/css/', | |
src: ['**/*.css'], | |
dest: 'static-build/checkout/css/' | |
}] | |
} | |
}, | |
requirejs: { | |
options: { | |
optimize: 'none', | |
generateSourceMaps: grunt.option('source-maps') !== false, | |
preserveLicenseComments: false, | |
paths: { | |
'jquery': 'lib/jquery/jquery', | |
'underscore': 'lib/underscore/underscore' | |
}, | |
shim: { | |
'lib/fontfaceobserver/fontfaceobserver': { | |
exports: 'FontFaceObserver' | |
} | |
} | |
}, | |
checkout: { | |
options: { | |
baseUrl: 'static-source/checkout/js/', | |
name: 'main', | |
out: 'static-build/checkout/js/main.js', | |
include: ['lib/require/almond'], | |
wrap: { | |
startFile: [ | |
'static-source/checkout/js/polyfills/es5.js', | |
'static-source/checkout/js/polyfills/placeholder.js', | |
'static-source/checkout/js/polyfills/requestAnimationFrame.js', | |
'static-source/checkout/js/polyfills/respond.js', | |
'static-source/checkout/js/polyfills/classList.js', | |
'static-source/checkout/js/polyfills/promise.js', | |
'static-source/checkout/js/polyfills/fetch.js' | |
] | |
} | |
} | |
} | |
}, | |
copy: { | |
checkout: { | |
files: [ | |
{ | |
expand: true, | |
cwd: 'static-source/', | |
src: 'fonts/**/*', | |
dest: 'static-build/' | |
} | |
] | |
} | |
}, | |
imagemin: { | |
checkout: { | |
files: [ | |
{ | |
expand: true, | |
cwd: 'static-source/img/', | |
dest: 'static-build/img/', | |
src: ['**/*.{png,gif,jpg,jpeg}'] | |
} | |
] | |
} | |
}, | |
svgmin: { | |
options: { | |
plugins: [ | |
{removeTitle: true}, | |
/* not working at present until next version of svgo */ | |
{removeDesc: true}, | |
/* this destroys the path on the search icon, turning it off */ | |
{convertPathData: false} | |
] | |
}, | |
checkout: { | |
files: [{ | |
expand: true, | |
cwd: 'static-source/img/', | |
dest: 'static-build/img/', | |
src: ['**/*.svg'] | |
}] | |
} | |
} | |
}); | |
grunt.registerTask('build', [ | |
'less', | |
'postcss', | |
'jshint', | |
'requirejs', | |
'copy', | |
'imagemin', | |
'svgmin' | |
]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment