Skip to content

Commit

Permalink
new folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mizok committed Apr 19, 2022
1 parent 0521883 commit 7c7c6cb
Show file tree
Hide file tree
Showing 52 changed files with 2,532 additions and 133 deletions.
28 changes: 9 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: webpack-playground-template
date:
author: Mizok
version: 0.2.3
version: 0.9.1
tags:
---

Expand All @@ -19,39 +19,29 @@ A webpack boilerplate for playground exmaple showcase that uses `ejs` as the tem

### Where to put my playground examples entry `ejs` files?

You have to put your examples entry `ejs` files in `./src/examples`.
You have to put your examples entry `ejs` files in `./src/examples/{YOUR_EXAMPLE_NAME}`, and you must name it `index.ejs`, so the full path will be `./src/examples/{YOUR_EXAMPLE_NAME}/index.ejs`.

### I would like to make some `ejs` files sharable as templates(ex:header.ejs),how can I make this?

- You have to put your template `ejs` files in `./src/template`.
- In your `ejs` file which you want to insert your template:

```html
<%- include('./src/template/header.ejs') %>
<%- include(`{YOUR_TEMPLATE_PATH(RELATIVE)}`) %>
```

for more detail, please check links below:

- https://github.com/dc7290/template-ejs-loader
- https://ejs.bootcss.com/

### How to connect example `ejs` file with example entry `ts` file/ example entry `scss` file?
### What kind of files do I need to create a new example?

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 `ex1.html`, and you are not going to use a specfic entry chunk, you will need:

- an `ex1.ejs` file in `./src/examples`
- an `ex1.ts` file in `./src/ts/examples`
- an `ex1.scss` file in `./src/scss/examples`

On the other hand, if you want your output page name to be `ex1.html`,and using a shared chunk named `main`, then you will need:

- an `ex1.main.ejs` file in `./src/examples`
- an `main.ts` file in `./src/ts/examples`
- an `main.scss` file in `./src/scss/examples`
first you have to create a folder under `src/examples` for your new example.
then you will have to add these files into the new folder:
- an `index.ejs`
- an `index.ts` or add a `ts` folder then add an `index.ts` inside it. (Optional)
- an `main.scss` or add a `scss` folder then add an `main.scss` inside it. (Optional)

### I want to get webpack `mode` environment argument in `ejs` file, how can I make this?

Expand Down
Loading

0 comments on commit 7c7c6cb

Please sign in to comment.