My default gulpfile.js
I am working on a new template for the apps I commonly craft these days, and right now it’s looking like this.
- Material Design Lite for the UI framework. Pros: no external JS dependencies (not even jQuery), fast, pretty, don’t have to worry about IE9 because it isn’t supported. Cons: IE9 isn’t supported.
- Leaflet for the mapping. Duh.
- Underscore for JSON handling and templates. Lodash is great, but I don’t use the extra features, it’s 7x the size, and I am too lazy to make a custom build to shrink it.
- Browserify for modular development and dependency management.
- Favor npm over bower for dependencies when possible. Makes Browserify and testing easier.
- A unit test framework. I haven’t put a finger on that yet. Maybe tape.
The first step is automating things with Gulp. I usually write my gulpfile.js
as a project goes along and by the time I’m done it’s a steaming mess. Here is my new default template.
1 | var postcss = require("gulp-postcss"), |
This should cover 90% of my needs for most projects. Tossing in Babel or React is a matter of adding Browserify transforms, and if Browserify gets slow adding Watchify into the mix isn’t hard. Live reload, CSS, JavaScript, and images are all handled. Source maps are created for CSS and JavaScript, and running gulp build --type production
minifies the CSS and uglifies the JavaScript.
My plan is to build out the template, dogfood it with a new GeoPortal release, and then put all of it on Github. Stay tuned.