Skip to content

Commit

Permalink
added gulpfile and package to git
Browse files Browse the repository at this point in the history
  • Loading branch information
ngr900 committed Nov 22, 2016
1 parent 95421f7 commit 4342f6a
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#npm

node_modules/
gulpfile.js
package.json

# Windows image file caches
Thumbs.db
Expand Down
82 changes: 82 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var uglify = require('gulp-uglify');
var del = require('del');
var useref = require('gulp-useref');
var runSequence = require('run-sequence');
var babel = require('gulp-babel')
var gulpIf = require('gulp-if');
var debug = require('gulp-debug');

var distDir = 'dist';

// DEVELOPMENT //

gulp.task('browserSync', function () {
browserSync.init({
server: {
baseDir: 'app'
},
})
});

gulp.task('watch', ['browserSync'], function () {
gulp.watch('app/*.html', browserSync.reload);
gulp.watch('app/*.js', browserSync.reload);
});

// PRODUCTION //

gulp.task('js-dist', function () {
return gulp.src('app/js/constellation.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(uglify())
.pipe(gulp.dest(distDir))
});

gulp.task('useref', function () {
return gulp.src('app/*.html')
.pipe(useref({
force: true
}))
.pipe(gulpIf('*.js', babel({
presets: ['es2015']
})))
.pipe(gulpIf('*.js', uglify()))
.pipe(gulp.dest('docs'))
});

gulp.task('clean:dist', function () {
return del.sync(distDir);
});

gulp.task('clean:docs', function () {
return del.sync('docs');
});

// DEPLOYMENT //

gulp.task('build-dist', function (callback) {
runSequence('clean:dist', ['js-dist'],
callback
)
})

gulp.task('build-docs', function (callback) {
runSequence('clean:docs', ['useref'],
callback
)
})

gulp.task('build', function (callback) {
runSequence('build-dist', 'build-docs',
callback
)
})

function swallowError(error) {
console.log(error.toString())
this.emit('end')
}
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "constellation.js",
"version": "1.0.0",
"description": "",
"main": "backvas.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ngr900/constellation.js.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/ngr900/constellation.js/issues"
},
"homepage": "https://github.com/ngr900/constellation.js#readme",
"devDependencies": {
"babel": "^6.5.2",
"babel-preset-es2015": "^6.18.0",
"browser-sync": "^2.18.2",
"del": "^1.2.1",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-debug": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-uglify": "^2.0.0",
"gulp-useref": "^3.0.0",
"run-sequence": "^1.2.2",
"uglify": "^0.1.5"
}
}

0 comments on commit 4342f6a

Please sign in to comment.