Use Grunt for building behind the scenes
This commit is contained in:
1 parent
68ff6285c2
commit
f5ed65a8e3
7 files changed
+126
-28
No files matched your search
@@ -0,0 +1,81 @@
|
||||
module.exports = function (grunt) {
|
||||
// Do grunt-related things in here
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
|
||||
clean: {
|
||||
default: {
|
||||
src: [
|
||||
'<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js',
|
||||
'<%= pkg.grunt.build.path %>/*'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
browserify: {
|
||||
default: {
|
||||
src: ['<%= pkg.grunt.src.path %>/debug.js', '<%= pkg.grunt.src.path %>/<%= pkg.grunt.src.script %>'],
|
||||
dest: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js'
|
||||
},
|
||||
build: {
|
||||
src: ['<%= pkg.grunt.src.path %>/<%= pkg.grunt.src.script %>'],
|
||||
dest: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js'
|
||||
}
|
||||
},
|
||||
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
|
||||
},
|
||||
default: {
|
||||
src: [],
|
||||
dest: []
|
||||
},
|
||||
build: {
|
||||
src: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js',
|
||||
dest: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js'
|
||||
}
|
||||
},
|
||||
|
||||
copy: {
|
||||
default: {
|
||||
files: [
|
||||
{
|
||||
src: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.script %>.js',
|
||||
dest: '<%= pkg.grunt.build.path %>/<%= pkg.grunt.build.script %>.js'
|
||||
},
|
||||
{
|
||||
src: '<%= pkg.grunt.src.path %>/<%= pkg.grunt.build.html %>',
|
||||
dest: '<%= pkg.grunt.build.path %>/<%= pkg.grunt.build.html %>'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
cachebreaker: {
|
||||
default: {
|
||||
options: {
|
||||
match: ['app.js'],
|
||||
replacement: 'time'
|
||||
},
|
||||
files: {
|
||||
src: ['<%= pkg.grunt.build.path %>/<%= pkg.grunt.build.html %>']
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Load the plugins.
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-cache-breaker');
|
||||
|
||||
// Default task(s).
|
||||
grunt.registerTask('default', ['clean', 'browserify:default', 'copy', 'cachebreaker']);
|
||||
grunt.registerTask('build', ['clean', 'browserify:build', 'uglify:build', 'copy', 'cachebreaker']);
|
||||
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
CSS Boilerplate
|
||||
*/
|
||||
|
||||
@import url('./node_modules/bootstrap/dist/css/bootstrap.min.css');
|
||||
@import url('./node_modules/bootswatch/darkly/bootstrap.min.css');
|
||||
@import url('./node_modules/highlight.js/styles/default.css');
|
||||
@import url('./node_modules/highlight.js/styles/monokai-sublime.css');
|
||||
|
||||
pre {
|
||||
outline: 1px solid #767676;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
textarea#input, code#output {
|
||||
width: 100%;
|
||||
height: 25em;
|
||||
}
|
||||
+21
-4
@@ -5,11 +5,10 @@
|
||||
"main": "js/app.js",
|
||||
"scripts": {
|
||||
"prebuild": "npm install",
|
||||
"build": "browserify -u debug.js -g uglifyify -o app.js index.js",
|
||||
"postbuild": "mkdir -p public_html/ && cp app.js public_html/ && cp index.html public_html/",
|
||||
"build": "grunt build",
|
||||
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
"build:dev": "browserify -d -o app.js index.js debug.js",
|
||||
"postbuild:dev": "npm run postbuild"
|
||||
"build:dev": "grunt"
|
||||
},
|
||||
"author": "Amrit Panesar <neo@neo.yt>",
|
||||
"license": "MIT",
|
||||
@@ -22,6 +21,13 @@
|
||||
"browserify-shim": "^3.8.13",
|
||||
"bulkify": "^1.4.2",
|
||||
"crypto-js": "^3.1.9-1",
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-browserify": "^5.0.0",
|
||||
"grunt-cache-breaker": "^2.0.1",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-clean": "^1.0.0",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"grunt-contrib-uglify": "^2.2.0",
|
||||
"hasher": "^1.2.0",
|
||||
"highlight.js": "^9.9.0",
|
||||
"html": "^1.0.0",
|
||||
@@ -32,6 +38,17 @@
|
||||
"uglifyify": "^3.0.4",
|
||||
"xml-beautifier": "^0.3.0"
|
||||
},
|
||||
"grunt": {
|
||||
"src": {
|
||||
"path": "./src",
|
||||
"script": "index.js"
|
||||
},
|
||||
"build": {
|
||||
"path": "./public_html",
|
||||
"script": "app",
|
||||
"html": "index.html"
|
||||
}
|
||||
},
|
||||
"browserify": {
|
||||
"transform": [
|
||||
"browserify-css",
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
CSS Boilerplate
|
||||
*/
|
||||
|
||||
@import url('../node_modules/bootstrap/dist/css/bootstrap.min.css');
|
||||
@import url('../node_modules/bootswatch/darkly/bootstrap.min.css');
|
||||
@import url('../node_modules/highlight.js/styles/default.css');
|
||||
@import url('../node_modules/highlight.js/styles/monokai-sublime.css');
|
||||
|
||||
pre {
|
||||
outline: 1px solid #767676;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
textarea#input, code#output {
|
||||
width: 100%;
|
||||
height: 25em;
|
||||
}
|
||||
File renamed without changes.
@@ -7,7 +7,7 @@
|
||||
window.$ = window.jQuery = require('jquery');
|
||||
|
||||
// include bootstrap css and javascript
|
||||
require('./app.css');
|
||||
require('./index.css');
|
||||
require('bootstrap');
|
||||
|
||||
// use hasher for application page management
|
||||
Reference in new issue
Block a user