Feature/#35 build tools #36
112
gulpfile.js
112
gulpfile.js
|
@ -7,6 +7,7 @@ const browserify = require('browserify');
|
||||||
Serraniel
commented
Review
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
const babelify = require('babelify');
|
const babelify = require('babelify');
|
||||||
const source = require('vinyl-source-stream');
|
const source = require('vinyl-source-stream');
|
||||||
const buffer = require('vinyl-buffer');
|
const buffer = require('vinyl-buffer');
|
||||||
|
const merge = require('merge-stream');
|
||||||
```suggestion
debug: isDev
```
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const $ = gulpLoadPlugins()
|
const $ = gulpLoadPlugins()
|
||||||
|
@ -33,17 +34,30 @@ const tmp = {
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
styles: '.tmp/stylesheets',
|
styles: '.tmp/stylesheets',
|
||||||
scripts: '.tmp/javascript',
|
scripts: '.tmp/javascript',
|
||||||
images: '.tmp/images',
|
images: '.tmp/images',
|
||||||
vendor: '.tmp/libs',
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dist path
|
// Dist path
|
||||||
const dist = {
|
const dist = {
|
||||||
root: 'dist',
|
root: 'dist',
|
||||||
manifests: 'dist/manifests',
|
chrome: {
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
styles: 'dist/stylesheets',
|
root: 'dist/chrome',
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
scripts: 'dist/javascript',
|
styles: 'dist/chrome/stylesheets',
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
images: 'dist/images',
|
scripts: 'dist/chrome/javascript',
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
vendor: 'dist/libs',
|
images: 'dist/chrome/images',
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
|
},
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
firefox: {
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
root: 'dist/firefox',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
styles: 'dist/firefox/stylesheets',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
scripts: 'dist/firefox/javascript',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
images: 'dist/firefox/images',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
},
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
opera: {
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
root: 'dist/opera',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
styles: 'dist/opera/stylesheets',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
scripts: 'dist/opera/javascript',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
images: 'dist/opera/images',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
},
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
zip: 'dist/zips',
|
||||||
```suggestion
debug: isDev
```
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build mode
|
// Build mode
|
||||||
|
@ -169,24 +183,82 @@ gulp.task('build', gulp.series('clean:build', 'manifests', 'images', 'scripts',
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
DIST CLEAN ALL
|
DIST CLEAN ALL
|
||||||
============================================================================ */
|
============================================================================ */
|
||||||
|
|
||||||
gulp.task('dist:copy', (done) => {
|
gulp.task('dist:chrome', (done) => {
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
// copy vendor
|
return merge(
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
gulp.src(`${tmp.vendor}/**/*`)
|
// copy images
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
.pipe(gulp.dest(dist.vendor))
|
gulp.src(`${tmp.images}/**/*`)
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.chrome.images)),
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
// copy images
|
// copy scripts
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
gulp.src(`${tmp.images}/**/*`)
|
gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`)
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
.pipe(gulp.dest(dist.images))
|
.pipe(gulp.dest(dist.chrome.scripts)),
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
// copy scripts
|
// copy styles
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`)
|
gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`)
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
.pipe(gulp.dest(dist.scripts))
|
.pipe(gulp.dest(dist.chrome.styles)),
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
// copy styles
|
gulp.src(`${tmp.manifests}/chrome*`)
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`)
|
.pipe($.rename('manifest.json'))
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
.pipe(gulp.dest(dist.styles))
|
.pipe(gulp.dest(dist.chrome.root))
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|||||||
|
);
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
})
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.task('dist:firefox', (done) => {
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
return merge(
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
// copy images
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${tmp.images}/**/*`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.firefox.images)),
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
// copy scripts
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.firefox.scripts)),
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
// copy styles
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.firefox.styles)),
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${tmp.manifests}/firefox*`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe($.rename('manifest.json'))
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.firefox.root))
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
);
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
})
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.task('dist:opera', (done) => {
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
return merge(
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
// copy images
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${tmp.images}/**/*`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.opera.images)),
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
// copy scripts
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${tmp.scripts}/**/*.{min.js,min.js.gz}`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.opera.scripts)),
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
// copy styles
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${tmp.styles}/*.{min.css,min.css.gz}`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.opera.styles)),
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${tmp.manifests}/opera*`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe($.rename('manifest.json'))
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.opera.root))
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
);
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
})
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.task('dist:copy', gulp.series('dist:chrome', 'dist:firefox', 'dist:opera'));
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.task('dist:zip', (done) => {
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${dist.chrome.root}/**/*`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe($.zip('chrome.zip'))
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.root));
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${dist.firefox.root}/**/*`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe($.zip('firefox.zip'))
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.root));
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
gulp.src(`${dist.opera.root}/**/*`)
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe($.zip('opera.zip'))
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
.pipe(gulp.dest(dist.root));
|
||||||
```suggestion
debug: isDev
```
|
|||||||
|
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('dist', gulp.series('clean', 'build', 'dist:copy'));
|
gulp.task('dist', gulp.series('clean', 'build', 'dist:copy', 'dist:zip'));
|
||||||
```suggestion
debug: isDev
```
```suggestion
debug: isDev
```
|
|
@ -34,6 +34,7 @@
|
||||||
Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors. Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors.
Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors. Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors.
|
|||||||
"gulp-sourcemaps": "^2.6.5",
|
"gulp-sourcemaps": "^2.6.5",
|
||||||
"gulp-uglify-es": "^2.0.0",
|
"gulp-uglify-es": "^2.0.0",
|
||||||
"gulp-zip": "^5.0.2",
|
"gulp-zip": "^5.0.2",
|
||||||
|
"merge-stream": "^2.0.0",
|
||||||
Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors. Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors.
|
|||||||
"sass": "^1.26.10",
|
"sass": "^1.26.10",
|
||||||
"vinyl-buffer": "^1.0.1",
|
"vinyl-buffer": "^1.0.1",
|
||||||
"vinyl-source-stream": "^2.0.0"
|
"vinyl-source-stream": "^2.0.0"
|
||||||
|
|
||||||
Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors. Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors.
Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors. Also feel free to add yourself here any time you like, see https://docs.npmjs.com/files/package.json#people-fields-author-contributors.
|
Loading…
Reference in a new issue