A standalone Front-End workflow for Laravel
- Laravel >= 5.3.x (requires PHP)
- BalmJS >= 3.x (requires Node.js)
npm install -g balm-core # required for balm 3.0
If you have composer installed globally you can run:
composer require balmjs/laravel-balm
Then run these commands to publish assets and config:
php artisan vendor:publish --provider="Balm\Runtime\BalmServiceProvider" --force
--force
: overwrite package.json
or manual edit it:
{
"scripts": {
"dev": "balm",
"prod": "balm -p"
},
"devDependencies": {
"balm": "^3.0.0-rc.2"
}
}
You should use Laravel's global balm
function within your views to load the appropriately hashed asset. The balm
function will automatically determine the current name of the hashed file:
<link rel="stylesheet" href="balm('css/app.css')" />
<script src="{{ balm('js/app.js') }}"></script>
Run the command in your project directory:
npm install
Then, you can install awesome libraries for your front-end project. (e.g. vue
)
Edit balm.config.js
in your project directory, modify to your virtual host:
module.exports = {
server: {
proxy: 'your.project.local' // Target host
}
// More Config
};
Run the command in your project directory:
# For development
npm run dev
# For production
npm run prod