Skip to content

Slynova-Org/symfony-encore

Repository files navigation

AdonisJS - Symfony Encore

This package wraps Symfony Encore to make it work seamlessly with AdonisJS.

Getting Started

This package is available in the npm registry. It can easily be installed with npm or yarn.

$ npm i @slynova/symfony-encore
# or
$ yarn add @slynova/symfony-encore

Then, you need to scaffold the package using the node ace invoke command.

$ node ace invoke @slynova/symfony-encore

Doing so will install @symfony/webpack-encore directly in your application, create a boilerplate configuration and setup few scripts in your package.json to build your assets.

How to Use

After tweaking the configuration according to the documentation, you can use the two helpers encoreLink and encoreScript in your Edge templates.

<!DOCTYPE html>
<html lang="en">
  <head>
    {{-- Styling --}}
    {{{ encoreLink('css/app') }}}

    {{-- Scripting --}}
    {{{ encoreScript('js/app') }}}
  </head>
  <body>
    {{-- .... --}}
  </body>
</html>

The parameter given to those helpers is the entry path you gave in your configuration.