641

Product support

Visit this product's website for support.

  • Added on Oct 6, 2020
  • Current version: 1.1.0
  • Platform Compatibility
    v3.x not tested
    v2.x not tested
    v1.x use latest
  • Created by
  • Public repository

Categories

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

  1. Create a themes/[YourTheme]/webpack.config.js (We are using Symfony Webpack Encore)
    Encore
        .setOutputPath('./assets/build/')
        .setPublicPath('/themes/[YourTheme]/assets/build')
  2. Add the build directory
  3. Build your theme
  4. 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

1.1.0

Added documentation and webpack_scripts() + webpack_styles() twig functions

Oct 05, 2020

1.0.0

Initial release

Oct 04, 2020