Boilerplate for static webpage development using the powerful webpack.
We recommend using Yarn as package manager. First, install all dependencies.
$ yarn
Run development mode using webpack-dev-server
$ yarn dev
Build html for production. Also upload assets to AWS S3 (optional).
$ yarn build
Copy environment configuration file from .env.example
$ cp .env.example .env
You can change app configuration through config.js instead of modifying webpack.config.js.
Bundle all js and scss file as entry into a chunk. Later, use this chunk for specific html page.
{
entry: {
main: [
'./src/js/index.js',
'./src/sass/style.scss',
],
}
}Do you prefer using jQuery in your project? If you don't, just change it to false.
{
jquery: true
}template is HTML source, filename is target HTML output with css and js included. And you have to add
chunks to each HTML Template.
{
html: [{
template: './src/index.html',
filename: 'index.html',
chunks: ['main'],
}]
}Set upload: true will activate automatic assets uploading to s3 when build process is running.
You can set bucket, directory, and your public S3 URL in options. Outputted HTML will replace local assets url with CDN url.
{
cdn: {
upload: false,
options: {
bucket: 'tokopedia-upload',
directory: 'assets-tokopoints/prod/static',
domain: 'https://ecs7.tokopedia.net/',
},
}
}This project use AirBnb javascript linter (documentation) as default.