-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
32 lines (28 loc) · 1019 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var gulp = require('gulp');
var concat = require('gulp-concat');
var wrap = require('gulp-wrap');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var codeWrapper = 'module.exports = function(ns) {\n\
var React = require(\'react\');\n\
var ReactDOM = require(\'react-dom\');\n\
var ReactDOMServer = require(\'react-dom/server\');\n\
var no = require(\'nommon\');\n\
\n\
<%= contents %>\n\
};\r\n';
var destinationFolder = './dist';
gulp.task('default', function() {
// Build server module
gulp.src(['./src/ns.viewReactMixin.js', './src/*.js'])
.pipe(concat('noscript-react.module.js'))
.pipe(wrap(codeWrapper))
.pipe(gulp.dest(destinationFolder));
// Build browser modules
gulp.src(['./src/ns.viewReactMixin.js', './src/*.js'])
.pipe(concat('noscript-react.js'))
.pipe(gulp.dest(destinationFolder))
.pipe(rename({ extname: '.min.js' }))
.pipe(uglify())
.pipe(gulp.dest(destinationFolder));
});