Open tabacitu opened 1 month ago
How everything would work - notes from conversation with @pxpm :
<?php
/** IN PRO COMPOSER PACKAGE */
// Step 1. Use the key in your blade file:
@basset('bp-datepicker-js')
@basset('bp-select2-js-'.$lang)
@basset('bp-bootstrap-js')
@basset('bp-slider-js', true, ['lazy' => true])
@basset('https://cdn.com/easymde.js')
// Step 2A. In ProServiceProvider:
Basset::map("bp-datepicker-js", "http://example.com/datepicker.js");
foreach ($languages as $lang) {
Basset::map('bp-select2-js-'.$lang, "https://cdn.com/$lang/select2.js");
}
/** IN MAIN PROJECT (LARAVEL APP) */
/** TO OVERRIDE A KEY */
// Step 1. In a custom class Bassets specifies, do:
Basset::map("bp-datepicker-js", "http://example.com/datepicker.1.1.js");
foreach ($languages as $lang) {
Basset::map('bp-select2-js-'.$lang, "https://cdn.com/$lang/select2.1.js");
}
Basset::map("bp-bootstrap-js", "http://bootstrap.com/smth.js", [
'integrity' => "80eh1iud01hiefe10eij10fks10f",
])
Basset::map("bp-slider-js", "http://slider.com/script.js")
Basset::map("https://cdn.com/easymde.js", "https://npmjs.com/easymde/easymde.js")
// Step 2. Optionally, run:
php artisan basset:cache
---
# Behind the scenes:
# .basset.cache:
"bp-datepicker-js" => "Web/user/public/example.com/datepicker.1.1.js"
"bp-select2-en-js" => "Web/user/public/cdn.com/en/select.2.1.js"
"bp-select2-ro-js" => "Web/user/public/cdn.com/ro/select.2.1.js"
"bp-select2-fr-js" => "Web/user/public/cdn.com/fr/select.2.1.js"
"bp-select2-pt-js" => "Web/user/public/cdn.com/pt/select.2.1.js"
"bp-bootstrap-js" => "Web/user/public/bootstrap.com/smth.js"
"bp-slider-js" => "Web/user/public/slider.com/script.js"
"bp-slider-js" => "Web/user/public/slider.com/script.js"
"https://cdn.com/easymde.js" => "Web/user/public/npmjs.com/easymde/easymde.js"
TODO:
public/bassets
), GIT IGNORED:php artisan basset:cache
on install, then have the assets (no more DEV_MODE);@basset('http://example.com/select2.'.$lang.'.js', ['lang' => ['en', 'ro', 'pt', 'it']])
http://raw.github.com/someone/somerepo/tag/1.2.3/asset.js
--
ALSO TO DO:
public/bassets
):php artisan basset:cache
on deploy;php artisan basset:cache
on install, then have the assets (no more DEV_MODE);php artisan basset:refresh
on local, you override the changed CSS and JS files => dirty diffs; β οΈDON'T DO:
--
LET'S NOT TALK ABOUT IT:
php artisan basset:update
)Examples: