Download the PHP package innocenzi/laravel-encore without Composer
On this page you can find all versions of the php package innocenzi/laravel-encore. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download innocenzi/laravel-encore
More information about innocenzi/laravel-encore
Files in innocenzi/laravel-encore
Package laravel-encore
Short Description Integrate Webpack Encore in Laravel.
License MIT
Homepage https://github.com/innocenzi/laravel-encore
Informations about the package laravel-encore
Laravel Encore
This package helps integrating Webpack Encore with Laravel.
Note: while this package should work, I'm not planning on fixing potential issues or updating it, since I'm no longer using it. If you want a better development environment, consider
Laravel Viteusing the new Vite integration from the Laravel team.
Installation
You can install the package via composer:
Installing Encore
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 @styles
and @scripts
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.