This plugin will render <style><script> tags for your entrypoints.json file, generated by webpack. It will just load the entrypoints.json file and render the tags, it won´t compile it for you.
Webpack Plugin for OctoberCMS
Prepare your theme
- Create a themes/[YourTheme]/webpack.config.js (We are using Symfony Webpack Encore)
Encore .setOutputPath('./assets/build/') .setPublicPath('/themes/[YourTheme]/assets/build')
- Add the build directory
- Build your theme
- Go on by implementing the tags
Using the plugin
Implement via functions
Use the following minimal skeleton or adapt it
<!DOCTYPE html> <html> <head> {{ webpack_styles("app", "assets/build/entrypoints.json") }} </head> <body> {{ webpack_scripts("app", "assets/build/entrypoints.json") }} </body> </html>
Implement via component
Use the following minimal skeleton or adapt it
[webpackStyles] entrypointsFile = "assets/build/entrypoints.json" // Default entrypoint = "app" // Default [webpackScripts] entrypointsFile = "assets/build/entrypoints.json" // Default entrypoint = "app" // Default == <!DOCTYPE html> <html> <head> {% component 'webpackStyles' %} </head> <body> {% component 'webpackScripts' %} </body> </html>
Configuration
You can configure it, by just change the values given in the examples above. These can be left blank, to use the default values
-
This plugin has not been reviewed yet.
-
1.1.0 |
Added documentation and webpack_scripts() + webpack_styles() twig functions Oct 05, 2020 |
---|---|
1.0.0 |
Initial release Oct 04, 2020 |