| title | date | author | version | tags |
|---|---|---|---|---|
webpack-template |
Mizok |
0.9.1 |
A webpack boilerplate that uses ejs as the template engine.
- Run
npm installornpm ifirst to install all dependencies. - Run
npm run devto start the dev-server.
You have to put your entry ejs files in ./src/pages.
- You have to put your template
ejsfiles in./src/template. - In your
ejsfile which you want to insert your template:
<%- include('./src/template/header.ejs') %>for more detail, please check links below:
Here we are actually talking about webpack entry chunks.
When designing this boilerplate, we tried to make chunk setting easy.
By Default, if you want your output page name to be index.html, and you are not going to use a specfic entry chunk, you will need:
- an
index.ejsfile in./src/pages - an
index.tsfile in./src/ts - an
index.scssfile in./src/scss
On the other hand, if you want your output page name to be index.html,and using a chunk named main, then you will need:
- an
index.main.ejsfile in./src/pages - a
main.tsfile in./src/ts - a
main.scssfile in./src/scss
Like this (in your ejs file) :
<!-- this will output development|production -->
<div><%= mode%></div> And this (in your js file) :
console.log(PROCESS.MODE) // this will output development|productionYou have to use alias path , not relative path(like below):
<img src="~@img/logo.png">