sulu / webpack-encore
A package to install webpack encore into your package without stimilus.
Installs: 98
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 5
Forks: 0
Open Issues: 0
Language:JavaScript
Requires
- php: ^7.2
- symfony/asset: ^4.4 || ^5.2
README
Simple Webpack Encore implementation, with sass-loader
for css.
This package provides a simple recipe for webpack encore
to use without Stimilus
integration and webpack-encore-bundle
.
Installation
composer require sulu/webpack-encore
The symfony/flex recipe should now generate the CSS/JS setup in your project directories.
Build CSS / JS
cd assets/website
npm install
npm run build
Embed JS / CSS
The JS:
<script src="{{ asset('build/website/main.js', 'website') }}"></script>
The CSS:
<link href="{{ asset('build/website/main.css', 'website') }}" rel="stylesheet">
After embedding you should see a colored background. This means your build did successfully work.
Remove Package
Now the best is you can savely remove this package. That symfony flex will not remove the recipe files we just checkout the composer files.
git checkout symfony.lock composer.lock composer.json
Preloading CSS / JS
If you want to preload the CSS or CSS you can do this using the symfony/web-link package:
composer require symfony/asset composer require symfony/web-link
After this just wrap the asset
function in preload
e.g.:
The JS:
<script src="{{ preload(asset('build/website/main.js', 'website')) }}"></script>
The CSS:
<link href="{{ preload(asset('build/website/main.css', 'website')) }}" rel="stylesheet">