Skip to content

Commit

Permalink
js compilation workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mtford90 committed Jun 5, 2015
1 parent 584be78 commit deafdca
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 17 deletions.
68 changes: 52 additions & 16 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,57 @@
/**
* Used for automating various tasks around testing & compilation.
*/
(function () {
"use strict";
var gulp = require('gulp'),
async = require('async'),
_ = require('underscore'),
plugins = require('gulp-load-plugins')();

var gulp = require('gulp'),
plugins = require('gulp-load-plugins')();

var webpack = {
externals: {
'react': 'React',
'jQuery': '$',
'underscore': '_',
'moment': 'moment',
'async': 'async'
},
devtool: 'inline-source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
}
};

gulp.task('watch', function () {
gulp.watch('scss/**/*.scss', ['scss']);
});

gulp.task('scss', function () {
gulp.src('scss/**/*.scss')
.pipe(plugins.scss())
.pipe(gulp.dest('silk/static/silk/css'))
});
gulp.task('watch', function () {
gulp.watch('scss/**/*.scss', ['scss']);
});

gulp.task('scss', function () {
gulp.src('scss/**/*.scss')
.pipe(plugins.scss())
.pipe(gulp.dest('silk/static/silk/css'))
});

var apps = {
summary: 'js/summary/index.js'
};

gulp.task('js', function (done) {
var appNames = Object.keys(apps),
tasks = _.map(appNames, function (appName) {
return function (done) {
var path = apps[appName],
config = _.extend({}, webpack);
gulp.src(path)
.pipe(plugins.webpack(config))
.pipe(plugins.rename(appName + '.js'))
.pipe(gulp.dest('silk/static/silk/js'))
.on('end', done);
}
});
async.parallel(tasks, done);
});

})();
2 changes: 2 additions & 0 deletions js/summary/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var React = require('react');

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@
},
"homepage": "https://github.com/mtford90/silk",
"devDependencies": {
"async": "^1.2.0",
"babel-core": "^5.5.3",
"babel-loader": "^5.1.4",
"gulp": "^3.8.10",
"gulp-rename": "^1.2.2",
"gulp-scss": "^1.1.1",
"gulp-shell": "^0.4.2",
"gulp-util": "^3.0.5",
"q": "^1.4.1"
"gulp-webpack": "^1.4.0",
"node-libs-browser": "^0.5.2",
"q": "^1.4.1",
"underscore": "^1.8.3",
"webpack": "^1.9.10"
}
}
59 changes: 59 additions & 0 deletions silk/static/silk/js/summary.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit deafdca

Please sign in to comment.