问题
I want to use select2 package in my laravel 5 application.
I installed it using npm install select2
and also ran npm run dev
. It appears in my node_modules folder.
But how do I actually refer to the files - js and scss of select2 package in my app.blade.php
?
回答1:
Run npm run watch
, because keeps track of all changes in .js
.
In app.js add
require('select2/dist/js/select2');
In app.blade.php example:
<div>
<select class="js-select2 css-select2-50">
<option>1</option>
</select>
</div>
来源:https://stackoverflow.com/questions/52402858/how-to-use-npm-installed-package-in-laravel-application