Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created July 26, 2019 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/7e1904f10aabf36385226d52157a06d4 to your computer and use it in GitHub Desktop.
Save tripflex/7e1904f10aabf36385226d52157a06d4 to your computer and use it in GitHub Desktop.
Gulp tasks for Mongoose OS to minify mJS code to save space on devices
var gulp = require('gulp');
var pump = require('pump');
var strip = require('gulp-strip-comments');
var cleanhtml = require('gulp-cleanhtml');
var flatten = require('gulp-flatten');
var replace = require('gulp-replace');
gulp.task('mindeps', function () {
return gulp.src('deps/**/**/*.js', { base: "./" })
.pipe(strip())
.pipe(cleanhtml())
.pipe(gulp.dest('.'));
});
gulp.task('minfs', function (cb) {
pump([
gulp.src(['fs/*.js', 'fs/**/*.js', '!fs/tmp/*', '!fs/test/*']),
strip(),
cleanhtml(),
flatten(),
gulp.dest('fs_min')
],
cb
);
});
@tripflex
Copy link
Author

The way I personally use this is by setting my fs in mos.yml to the fs_min directory, and before pushing just run gulp minfs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment