123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- 'use strict';
- import gulp from 'gulp';
- const { series, src, dest, watch } = gulp;
- import gulpif from 'gulp-if';
- import * as dartSass from 'sass';
- import gulpSass from 'gulp-sass';
- const sass = gulpSass(dartSass);
- import autoprefixer from 'gulp-autoprefixer';
- import stripDebug from 'gulp-strip-debug';
- import jsmin from 'gulp-jsmin';
- import cssmin from 'gulp-cssmin';
- import rename from 'gulp-rename';
- import minimist from 'minimist';
- import mainBowerFiles from 'main-bower-files';
- import svgmin from 'gulp-svgmin';
- // var shared_variables = JSON.parse(fs.readFileSync('./assets/json/shared_variables.json'));
- // to get minified assets run `gulp --env=prod`
- var argv = minimist(process.argv.slice(2));
- console.dir(argv);
- var prod = argv.env === 'prod' ? true : false;
- function handleError(err) {
- console.log(err.toString());
- }
- async function scripts() {
- return src(['./assets/scripts/main.js', './assets/scripts/redirect.js']) // './assets/scripts/shared_variables.js',
- // .pipe(concat('main.js'))
- .pipe(gulpif(prod, stripDebug()))
- .pipe(gulpif(prod, jsmin()))
- .pipe(rename({suffix: '.min'}))
- .pipe(dest('./assets/dist/scripts/'));
-
- }
- async function styles() {
- return src(['./assets/styles/app.scss'])
- .pipe(sass().on('error', sass.logError))
- .pipe(autoprefixer({
- cascade: false
- })).on('error', handleError)
- // .pipe(prod ? cssmin() : util.noop())
- .pipe(gulpif(prod, cssmin()))
- // .pipe(cssmin())
- .pipe(rename({suffix: '.min'}))
- .pipe(dest('./assets/dist/styles/'));
- }
- async function bower(){
- return src(mainBowerFiles({
- "overrides":{
- "masonry-layout":{
- "main":"./dist/masonry.pkgd.min.js"
- },
- "imagesloaded":{
- "main":"./imagesloaded.pkgd.min.js"
- },
- "jquery":{"ignore":true},
- "ev-emitter":{"ignore":true},
- "fizzy-ui-utils":{"ignore":true},
- "get-size":{"ignore":true},
- "outlayer":{"ignore":true},
- }
- }))
- .pipe(dest('./assets/dist/bower/'));
- }
- async function minsvg(){
- return src(['./assets/img/*.svg', '!./assets/img/edlp-loader-anim.svg'])
- .pipe(svgmin())
- .pipe(dest('./assets/dist/img'));
- }
- async function svg(){
- return src('./assets/img/edlp-loader-anim.svg')
- .pipe(dest('./assets/dist/img'));
- }
- function devwatch(){
- watch('./assets/styles/*.scss', styles);
- watch('./assets/styles/base/*.scss', styles);
- watch('./assets/scripts/*.js', scripts);
- watch('./assets/img/*.svg', svg);
- }
- export default series(scripts, styles, svg, minsvg);
- export { devwatch }
|