A fork of zephir/zephir-gulp-workflow with added sourcemaps and other things.
- sourcemaps
- broswerify
- pngquant
gulp cleanup
for file removal (sourcemaps)- gulp-notify
- favicons
- a lot of configuration has defaults
js
andes6
are the same task, but can have different configurations (e.g. babel or no-babel)
- config files are located at the root of your
package.json
and are calledgulp-config.js
(notcompileConfig.js
as withzephir-gulp-workflow
) - sourcemaps are enabled for dev env by default
- pxToRem is removed
- es6 via babel and browserify are enabled for a specific task and source folder per default (
babel-preset-env
+ browserstring) - added imagemin options
- Create a package.json in your project >>
npm init
- Install dependencies >>
npm i --save-dev gulp mj-gulp-workflow
- Create a new
gulpfile.js
and add the content you find below
require('mj-gulp-workflow')(require('gulp'));
run gulp
to create a gulp-config.js
, configure to taste.
tasks in combinedTasks
are run in sequence, so if you want parallel execution you would have to put them in another array inside combinedTasks
, e.g.:
combinedTasks: {
dist: ["es6", "js", "images", "svg", "css", "copy", "clean"], // runs sequential
default: [["dist", "watch"]], // runs parallel
},
a lot of configurable stuff has defaults, that can be overwritten. These defaults are not in the gulp-config to keep it clean. They can still be readded and overwrite the defaults. The defaults are:
css: {
scss: {
config: {
outputStyle: 'compressed' }
},
sourcemaps: {
enabled: 'dev'
},
autoprefixer: {
enabled: true,
config: {
browserlist: ['> 0.1%']
}
},
cleanCss: {
enabled: true,
config: {
compatibility: 'ie8'
}
}
},
js: {
sourcemaps: {
enabled: 'dev'
},
browserify: {
enabled: true
},
babeljs: {
enabled: true,
config: {
minified: true,
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: ['> 0.1%']
}
}
]
]
}
}
},
images: {
imagemin: {
enabled: true,
config: [
imagemin.gifsicle(),
imagemin.jpegtran({ progressive: true }),
imagemin.optipng({ optimizationLevel: 5 }),
imagemin.svgo({ plugins: [{ removeViewBox: true }] })
],
additional: false
}
},
svg: {
svgmin: {
enabled: true,
config: {}
}
}
The favicons
-task has no defaults. Configuration looks like this:
favicons: {
enabled: true,
themeColor: '#cafe23',
iconsPath: './',
appName: 'FoobarBaz'
},
Run gulp dist --env dist
for distribution, otherwise just gulp
.
Dev server: npm run testd
Build with npm run babel-dist
Run tests witch npm test
Run test http server with npm run testd
=> http://localhost:8080, then look at the console.
- fix sourcemaps using babel and browserify
- reintroduce a way to mark
gulp-config.js
files as outdated and show instructional messages after an update - patch vulnerabilities brought by
gulp-imagemin
,rfg-api
andcli-real-favicon
by updating or replacing these dependencies
- Updated dependencies
- Updated dependencies
- npm audit fix
- created defaults for a lot of configuration to shrink down
gulp-config.js
- Updated dependencies
- Updated dependencies + fix pngquant – thank you @hoffmannclaus!
- Added
jsConcat
task for easier vendor file concatenation
- Dependency updates, vulnerabilities and a small improvement to gif optimization
- Dependency updates, dependency updates and more dependency updates!
- As of now, everything is up to date and
npm audit
"found 0 vulnerabilities" 🎉
- add
gulp-touch
to modify dist files' mtime. See this issue over at gulpjs/gulp.
- fix an issue with non-existing source files and
gulp.src()
- improved testing
- Port the watch task to gulp 4 *Whoopsie Daisies*
- Updated to gulp 4
- Remove unnecessary dependencies
- Patch many vulnerabilities
- update and clean up dependencies, including some major versions
- updated dependencies including major versions
- Fix installation issues
- Added favicon task using realfavicongenerator.net's CLI module
- updated dependencies including major versions
- updated dependencies
- fixed bug that made gulp process crash on first run
- move babel-transformation for es6 files to own source/task combo
cleanup
task is nowclean
- improved task defaults,
dev
anddist
as--env
options, defaults todev
. - updated dependencies
- remove config version check
- fix cleanup task for paths outside gulp directory
- fix babel when gulp task is in subdirectory
- add browserify (optional)
- add tests for copy and cleanup tasks
- code refactoring
- renamed
compileConfig.js
anddefaultConfig.js
- remove pxToRem task
- merge changelog into README.md
- fix default config
- Fix run-sequence and cleanup task
- Filter junk files in task inclusion by glob and remove output dir before running gulp test
- added cleanup task for file removal (sourcemaps)
- added gulp-notify for errors
- replaced native gulp.watch with gulp-watch for better error handling
- cleanup, refactoring and overall code quality
- Moved testing to jest
- Run tests with
npm test
(rungulp dist
first!)