Skip to content

Instantly share code, notes, and snippets.

@sk8terboi87
Last active December 26, 2015 04:39
Show Gist options
  • Save sk8terboi87/7094879 to your computer and use it in GitHub Desktop.
Save sk8terboi87/7094879 to your computer and use it in GitHub Desktop.
A automated thing + builder script using https://gruntjs.com! Does Coffee to html, Jade to Html Does livereload and compilation of above Finally, Able to build the finally compressed, uglified script for production usage (File mentioned below are just examples... will be fixed sooner ^^")
{
"name": "Uploader",
"title": "AngularJs BlueImp Uploader!",
"description": "A custom doc reader to editor",
"version": "0.1.0",
"homepage": "https://github.com/sk8terboi87/angularjs-tutorial",
"author": {
"name": "Sk8terboi86",
"url": "http://code-like-a-poem.blogspot.in"
},
"repository": {
"type": "git",
"url": "git://github.com/sk8terboi87/angularjs-tutorial.git"
},
"bugs": "https://github.com/sk8terboi87/angularjs-tutorial/issues",
"licenses": [
{
"type": "MIT",
"url": ".."
}
],
"dependencies": {
"jquery": "1.7"
},
"keywords": ["jquery", "angularjs", "uploader", "blueimp"]
}
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('build_package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
clean: {
src: ['dist']
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: [
'components/jquery.js',
'components/blueimp/blueimp.js', // Dummy!
'app/scripts/**/*.js'
],
dest: 'dist/ba-<%= pkg.name %>.js'
},
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/ba-<%= pkg.name %>.min.js'
},
},
coffee: {
compile: {
files: {
'app/scripts/kickstart.js': 'coffee/kickstart.coffee',
'app/scripts/plugins/uploader.js': 'coffee/plugins/uploader.coffee',
},
options: {
basePath: 'app/scripts',
}
},
},
jade: {
compile: {
files: {
"app/index.html": "jade/index.jade",
"app/views/templates/uploader.html": "jade/templates/uploader.jade"
}
},
options: {
pretty: true
}
},
watch: {
coffee: {
files: [
'coffee/*.coffee',
'coffee/**/*.coffee'
],
tasks: 'coffee:compile'
},
jade: {
files: [
'jade/*.jade',
'jade/**/*.jade'
],
tasks: 'jade:compile'
},
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-jade');
// Default task.
grunt.registerTask('default', ['coffee', 'jade', 'watch']);
grunt.registerTask('build', ['clean', 'concat', 'uglify']);
};
{
"name": "jquery-plugin",
"version": "0.0.0-ignored",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "grunt qunit"
},
"devDependencies": {
"grunt-contrib-clean": "~0.4.0rc6",
"grunt-contrib-jshint": "0.1.1rc6",
"grunt-contrib-qunit": "0.1.1rc6",
"grunt-contrib-concat": "0.1.2rc6",
"grunt-contrib-uglify": "0.1.1rc6",
"grunt-contrib-watch": "0.2.0rc5",
"grunt": "0.4.0rc7",
"grunt-contrib-coffee": "~0.7.0",
"grunt-contrib-jade": "~0.8.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment