#How to use
Clone this repo and then in command line type:
npm install
- install all dependenciesgulp
- run dev-server and let magic happen, orgulp build
- build project from sources
--
To run separate task type in command line gulp [task_name]
.
Almost all tasks also have watch mode - gulp [task_name]:watch
, but you don't need to use it directly.
Task name | Description |
---|---|
default |
will start all tasks required by project in dev mode: initial build, watch files, run server with livereload |
build:dev |
build dev version of project (without code optimizations) |
build |
build production-ready project (with code optimizations) |
Task name | Description |
---|---|
sass |
compile .sass/.scss to .css. We also use postcss for autoprefixer, so feel free to include other awesome postcss plugins when needed |
browserify |
compile .js sources into bundle file |
webpack |
compile .js sources into bundle file |
copy |
copy common files from ./src path to ./dist path |
swig |
compile swig templates |
nunjucks |
compile Mozilla's awesome nunjucks templates |
jade |
compile jade templates |
svgo |
optimize svg files with svgo |
iconfont |
compile iconfonts from svg sources |
sprite:svg |
create svg symbol sprites (css-tricks) |
sprite:png |
create png sprites |
server |
run dev-server powered by BrowserSync |
clean |
remove ./dist folder |
index-page |
create index file with links to all project pages |
This is a full list of tasks, that we use in our projects, but not all of them should be available in current project. For example, we only use one template engine out of these three [jade
, nunjucks
, swig
]. Or if project uses webpack
, then browserify
is not needed at all, and vise versa. All available tasks are placed in a folder ./gulp/tasks
as separate *.js files. Usually, file name = task name.
We have several useful flags.
gulp --open
orgulp server --open
- run dev server and then open preview in browsergulp --tunnel=[name]
orgulp server --tunnel [name]
- runs dev server and allows you to easily share a web service on your local development machine (powered by localtunnel.me). After this command your local site will be available over[name].localtunnel.me
link.gulp [task_name] --prod
orgulp [task_name] --production
- run task in production mode. Some the tasks (for example, sass or js compilation) have additional optimization for production mode (such as code minification), so with this flag you can force production mode.gulp build
uses this mode by default.
##Other You can also use npm scripts:
npm run ghpages
to push only./dist
folder to gh-pages branch on github (very useful for previews).npm run start
- same asgulp default
.npm run build
- same asgulp build
.