Download the PHP package terpomoj/laravel-encore without Composer
On this page you can find all versions of the php package terpomoj/laravel-encore. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download terpomoj/laravel-encore
More information about terpomoj/laravel-encore
Files in terpomoj/laravel-encore
Package laravel-encore
Short Description Integrate Webpack Encore in Laravel.
License MIT
Homepage https://github.com/terpomoj/laravel-encore
Informations about the package laravel-encore
Laravel Encore
This package helps to integrate Webpack Encore with Laravel.
This package was originally authored by @innocenzi. As they claimed to not going to maintain it anymore, I decided to fork it and continue to provide support for it.
Installation
You can install the package via composer:
Installing Encore
Manually
Remove laravel-mix
and add @symfony/webpack-encore
.
Remove your webpack.mix.js
and create a webpack.config.js
. Here is an example:
Make sure resources/js/app.js
exists. Ideally, it should import your CSS as well, but if you don't want to, you can add addStyleEntry
to your Encore configuration.
Make sure you add public/build/
(or whatever output path you set) to your .gitignore
.
Last, but not least, you should replace the scripts in your package.json
with the following:
Usage
In your blade components, use the @encoreStyles
and @encoreScripts
directives to include the assets generated by Encore.
By default, it will look for the app
entries, but you can change them by passing an entry name in each directive.
If you used static assets, you can use Encore::asset('build/path/to/your/asset.png')
to include it. Under the hood, it's just a mapping to the manifest.json.
License
The MIT License (MIT). Please see License File for more information.