/html-app-boilerplate

HTML5 App Boilerplate with Gulp and Webpack

Primary LanguageJavaScriptMIT LicenseMIT

Zenway.code HTML App Boilerplate

#How to use

Clone this repo and then in command line type:

  • npm install or yarn - install all dependencies
  • gulp - run dev-server and let magic happen, or
  • gulp build - build project from sources

--

List of Gulp tasks

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.

Main tasks

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)

Other tasks

Task name Description
styles compile .sass/.scss to .css. We also use postcss for autoprefixer and Lost, so feel free to include other awesome postcss plugins when needed
webpack compile .js sources into bundle file
copy copy common files from ./app path to ./dist path
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
ftp upload ./dist folder to specified FTP server

Flags

We have several useful flags.

  • gulp --open or gulp server --open - run dev server and then open preview in browser
  • gulp --tunnel=[name] or gulp server --tunnel [name] - runs dev server and allows you to easily share a web service on your local development machine (powered by localtunnel.me). Your local site will be available at [name].localtunnel.me.
  • gulp [task_name] --prod or gulp [task_name] --production - run task in production mode. Some of the tasks (like, sass or js compilation) have additional settings for production mode (such as code minification), so with this flag you can force production mode. gulp build uses this mode by default.

Deploy

Specify credential for FTP server into ftp_credentials.json

  • npm run deploy - build project and upload ./dist folder to specified FTP server

##Other You can also use npm scripts:

  • npm run start - same as gulp default.
  • npm run build - same as gulp build.
  • npm run lint - linting javascript with eslint.
  • npm run lint:fix - fix as many issues as possible relatives to eslint settings.