https://github.com/jamesnuttall/injecttwigwebpackplugin
Webpack plugin to inject twig js/css register syntax.
https://github.com/jamesnuttall/injecttwigwebpackplugin
css html injects javacript twig webpack webpack-plugin
Last synced: 24 days ago
JSON representation
Webpack plugin to inject twig js/css register syntax.
- Host: GitHub
- URL: https://github.com/jamesnuttall/injecttwigwebpackplugin
- Owner: JamesNuttall
- Created: 2019-01-15T10:15:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-01T20:38:47.000Z (over 6 years ago)
- Last Synced: 2025-04-20T08:17:59.648Z (about 2 months ago)
- Topics: css, html, injects, javacript, twig, webpack, webpack-plugin
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
inject-twig-webpack-plugin
===[](https://nodei.co/npm/inject-twig-webpack-plugin/)
based off [inject-html-webpack-plugin](https://github.com/ali322/inject-html-webpack-plugin). Takes js/css files and using the twig `view.register` syntax, injects the files.
Install
===```javascript
npm install inject-twig-webpack-plugin --save--dev
```Usage
===add plugin in your webpack.config.js
```javascript
var InjectTwigPlugin = require('inject-twig-webpack-plugin');module.exports = {
entry:{
index:"./index.js"
},
module:{
loaders:[
...
]
},
output:{
path:'./dist',
filename:'[name].min.js'
},
plugins:[
new InjectTwigPlugin({
transducer: function (filename) {
return "/assets/js/vue/dist/"+filename;
},
filename: '../../../../templates/_layout/_footer.html',
chunks:['index']
})
]
}
```then add below placeholders into html file
```html
Document
```
Output
===```
{% do view.registerJsFile(siteUrl ~ "/assets/js/vue/dist/index.c38144da9d3ebd917778.js") %}```
## License
[MIT License](http://en.wikipedia.org/wiki/MIT_License)