Skip to content

Instantly share code, notes, and snippets.

@sandywu
Created January 22, 2014 06:19
Show Gist options
  • Save sandywu/8554234 to your computer and use it in GitHub Desktop.
Save sandywu/8554234 to your computer and use it in GitHub Desktop.
/*
* grunt-init-jquery
* https://gruntjs.com/
*
* Copyright (c) 2013 "Cowboy" Ben Alman, contributors
* Licensed under the MIT license.
*/
// Basic template description.
exports.description = 'Create Wap RC';
// Template-specific notes to be displayed before question prompts.
exports.notes = 'none';
// Template-specific notes to be displayed after question prompts.
exports.after = 'You should now install project dependencies with _npm ' +
'install_. After that, you may execute project tasks with _grunt_. For ' +
'more information about installing and configuring Grunt, please see ' +
'the Getting Started guide:' +
'\n\n' +
'http://gruntjs.com/getting-started';
// Any existing file or directory matching this wildcard will cause a warning.
exports.warnOn = '*';
// The actual init template.
exports.template = function(grunt, init, done) {
init.process({type: 'jquery'}, [
// Prompt for these values.
init.prompt('name')
], function(err, props) {
// A few additional properties.
props.jqueryjson = props.name + '.jquery.json';
props.dependencies = {jquery: props.jquery_version || '>= 1'};
props.keywords = [];
// Files to copy (and process).
var files = init.filesToCopy(props);
// Add properly-named license files.
//init.addLicenseFiles(files, props.licenses);
// Actually copy (and process) files.
init.copyAndProcess(files, props);
//Generate package.json file, used by npm and grunt.
// init.writePackageJSON('package.json', {
// name: 'jquery-plugin',
// version: '0.0.0-ignored',
// npm_test: 'grunt qunit',
// // TODO: pull from grunt's package.json
// node_version: '>= 0.8.0',
// devDependencies: {
// 'grunt-contrib-jshint': '~0.6.0',
// 'grunt-contrib-qunit': '~0.2.0',
// 'grunt-contrib-concat': '~0.3.0',
// 'grunt-contrib-uglify': '~0.2.0',
// 'grunt-contrib-watch': '~0.4.0',
// 'grunt-contrib-clean': '~0.4.0',
// },
// });
//Generate jquery.json file.
// init.writePackageJSON(props.jqueryjson, props, function(pkg, props) {
// // The jQuery site needs the "bugs" value as a string.
// if ('bugs' in props) { pkg.bugs = props.bugs; }
// return pkg;
// });
// All done!
done();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment