Requirements: Make sure you have node version 8
npm i breathecode-cli -g
$ bc start:vanillajs-project -r
$ npm install
Build the application for the first time...
$ npm run build
And start coding your Vanilla.js application, update the index.html
, index.css
or index.js
depending on your needs.
Right click on ./index.html
and choose the RUN option on the menu.
It depends on the language, but you have ./src/js/index.js
, ./src/css/index.css
and ./index.html
respectively, you can add new .html
as you please, just make sure to include the bundle.js using the <script>
tag.
Note: remember that the JS workflow starts inside window.onload
.
Remember that you have to re-bundle every time you update your SCSS or JS files $ npm run build
.
Remember also to refresh cleaning the cache (command+shift+r on mac, control+shift+r on pc & linux)
Please check the output on the console after bundling; maybe you have an error when bundling. Also, check the chrome inspector for errors on the console.
Just add them into your HTML file, the same way you did before knowing about WebPack.
If the JS file is not your own, you can import it using <script>
tags on your index.html before the </body>
closing tag. If the file is yours is better to add it using the import statement inside index.js content.
This boilerplate does not support the webpack development server; you have to $ npm run build
every time you update your JS or SCSS files.
This boilerplate is 100% compatible with the free github pages hosting. Publish your website by runing:
$ npm run deploy
Very easy and in just one step! Push to your master branch and use the free hosting that comes with GitHub pages, the project is ready to be published. Remember to choose to run the Github Page from your master branch.