English / 日本語
All modules for both build system and frontend development are managed by npm.
If you cloned an existing project from Git repository, run npm install
before starting development.
First, start localhost server for your development.
$ npm start
This command does following tasks:
- Start Browsersync server and open
http://localhost:3000
on your web browser. - Validate and compile source code when you save a file.
- Refresh browser automatically when you update the page.
Your can see the compiler/server/linter log on your terminal. If you want to quit this process, press Cntl + C.
Develop your web application by editing files in "app" directory.
Tips:
- Create Sass partial modules
- Create JavaScript modules
- Use CSS/Sass libraries
- Use JavaScript libraries
- Use jQuery plugins
- Include JavaScript without Browserify
When you finish editing app, you should build your project before git-commit.
$ npm run build
This command does:
- Test your source code at first.
- Compile/optimize files and output artifacts into "dist" directory.
Note: Usage of directories
- "app" - Files for development. This directory contains source code and original assets.
- "dist" - Files for production. This directory is not tracked in the Git main branch. Do not edit files directly.
Check the built contents. Start localhost server using "dist" directory.
$ npm run serve:dist
Looks good? If so, create a git-commit and push it to remote repository.
Upload built files to deployment branch.
$ npm run deploy
By default, built files will be pushed to "gh-pages" branch of your remote repository.
See Create deployment branch for more details.