Skip to content

Commit

Permalink
Refactor the build
Browse files Browse the repository at this point in the history
- No more local dependency files
- Use browserify to output a UMD compatible module
- The abyssa internal modules have clearer dependencies (require calls at the top)
- Get rid or Bower, which is redundant when using NPM/browserify
- The default build file (abyssa.js) is now the one without embedded dependencies
  • Loading branch information
AlexGalays committed Nov 5, 2013
1 parent 0197a98 commit 1e8006c
Show file tree
Hide file tree
Showing 24 changed files with 5,165 additions and 8,080 deletions.
3 changes: 1 addition & 2 deletions .gitignore
@@ -1,2 +1 @@
node_modules node_modules
bower_components
67 changes: 38 additions & 29 deletions Gruntfile.js
Expand Up @@ -2,52 +2,60 @@ module.exports = function(grunt) {


var banner = '/* <%= pkg.name %> <%= pkg.version %> - <%= pkg.description %> */\n\n'; var banner = '/* <%= pkg.name %> <%= pkg.version %> - <%= pkg.description %> */\n\n';


var libFiles = [ var dependencies = [
'lib/signals.js', 'when',
'lib/crossroads.js', 'signals',
'lib/when.js', 'crossroads',
'lib/history.iegte8.js', 'html5-history-api/history.iegte8'
];

var srcFiles = [
'src/header.js',
'src/util.js',
'src/StateWithParams.js',
'src/Transition.js',
'src/State.js',
'src/Router.js',
'src/anchorClicks.js',
'src/footer.js'
]; ];


grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),

browserify: {
build: {
files: {'target/abyssa.js': ['src/main.js']},
options: {
standalone: 'Abyssa',
ignore: dependencies
}
},
buildWithDeps: {
files: {'target/abyssa-with-deps.js': ['src/main.js'] },
options: {
standalone: 'Abyssa'
}
}
},

concat: { concat: {
options: { options: {
banner: banner banner: banner
}, },
buildWithDeps: { build: {
src: libFiles.concat(srcFiles), src: ['target/abyssa.js'],
dest: 'target/<%= pkg.name %>.js' dest: 'target/abyssa.js'
}, },
buildWithoutDeps: { buildWithDeps: {
src: srcFiles, src: ['target/abyssa-with-deps.js'],
dest: 'target/<%= pkg.name %>-nodeps.js' dest: 'target/abyssa-with-deps.js'
} }
}, },

uglify: { uglify: {
options: { options: {
banner: banner banner: banner
}, },
buildWithDeps: { build: {
src: 'target/<%= pkg.name %>.js', src: 'target/abyssa.js',
dest: 'target/<%= pkg.name %>.min.js' dest: 'target/abyssa.min.js'
}, },
buildWithoutDeps: { buildWithDeps: {
src: 'target/<%= pkg.name %>-nodeps.js', src: 'target/abyssa-with-deps.js',
dest: 'target/<%= pkg.name %>-nodeps.min.js' dest: 'target/abyssa-with-deps.min.js'
} }
}, },

watch: { watch: {
all: { all: {
files: ['src/*.js'], files: ['src/*.js'],
Expand All @@ -59,7 +67,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');


grunt.registerTask('default', ['concat', 'uglify']); grunt.registerTask('default', ['browserify', 'concat', 'uglify']);
grunt.registerTask('dev', ['default', 'watch']); grunt.registerTask('dev', ['default', 'watch']);
}; };
25 changes: 0 additions & 25 deletions bower.json

This file was deleted.

0 comments on commit 1e8006c

Please sign in to comment.