@ocombe
github.com/ocombe
Front end dev @
Continuous
Integration
Continuous
Delivery
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
src: 'src/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['uglify']);
};
var gulp = require('gulp');
var uglify = require('gulp-uglify');
gulp.task('compress', function() {
return gulp.src('lib/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
exports.config =
files:
javascripts:
joinTo:
'javascripts/app.js': /^app/
var uglifyJavaScript = require('broccoli-uglify-js')
var pickFiles = require('broccoli-static-compiler')
// create tree for files in the app folder
var app = 'app'
app = pickFiles(app, {
srcDir: '/',
destDir: 'appkit' // move under appkit namespace
})
appJs = uglifyJavaScript(app, {
// mangle: false,
// compress: false
});
// export the js tree
module.exports = appJs;
browserify -t es6ify main.js | exorcist bundle.js.map > bundle.js
module.exports = {
context: __dirname + '/app',
entry: './index.js',
output: {
path: __dirname + '/app',
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
}]
}
};
<!doctype html>
<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script>
System.import('lib/main');
</script>
System.config({
// or 'traceur' or 'typescript'
transpiler: 'babel'
// or traceurOptions or typescriptOptions
babelOptions: {}
});
index.html
config.js
import _ from 'lodash-node/modern/lang/isEqual';
import $ from 'jquery';
export function bootstrap() {
// bootstrap code here
}
import {bootstrap} from './bootstrap';
bootstrap();
main.js
bootstrap.js
var MyController = function($scope, greeter) {
// ...
}
MyController.$inject = ['$scope', 'greeter'];
When you fail,
fail fast,
and not silently
Testing is not wasting time,
it's compensating your flaws
and betting on the long term
/**
*
* @ngdoc directive
* @name awesomeElement
* @module myModule
* @restrict E
* @description
* This is a directive!
*
**/