https://github.com/ibrahimrahhal/webpack-file-inherit
Webpack loader that enables pug like inheritance for any file type
https://github.com/ibrahimrahhal/webpack-file-inherit
cli cli-app extend extendable inheritance loader pug webpack webpack-loader
Last synced: about 2 months ago
JSON representation
Webpack loader that enables pug like inheritance for any file type
- Host: GitHub
- URL: https://github.com/ibrahimrahhal/webpack-file-inherit
- Owner: Ibrahimrahhal
- License: mit
- Created: 2021-02-26T13:32:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-13T17:44:53.000Z (about 4 years ago)
- Last Synced: 2025-04-10T04:13:08.824Z (about 2 months ago)
- Topics: cli, cli-app, extend, extendable, inheritance, loader, pug, webpack, webpack-loader
- Language: TypeScript
- Homepage:
- Size: 33.2 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Webpack File Inherit Loader
Enables you to add Pug like extending/ inheritance cabilites to any file type#### Note: this loader is still under development & not ready to be used in production
## Getting Started
To begin, you'll need to install `webpack-file-inherit`:
```console
npm install --save-dev webpack-file-inherit
```Then add the loader to your `webpack` config for a specific file type. For example:
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.js/i,
loader: 'webpack-file-inherit',
},
],
},
};
```
## Inheritance
This loader enables you to exends files is a simlier way that pug templting engine do you have to define blocks first**Parent.js**
```js
var x = 16;
/* @block secondValue */
var y = 15;
/* @terminate block */
console.log(x*y);
```
**Child.js**
```js
/* @extends "./Parent.js" */
/* @block secondValue */
var y = 0;
/* @terminate block */
```
bunding the Child.js will result this file
```js
var x = 16;
var y = 0;
console.log(x*y);
```
## ContributingPlease take a moment to read our contributing guidelines if you haven't yet done so.
[CONTRIBUTING](./.github/CONTRIBUTING.md)
## License
[MIT](./LICENSE)