jeudi 25 janvier 2018

Laravel and bootstrap glyphicons - where are files copied, how to set relative path and how to solve cachebusting?

Im having trouble understanding how to use glyphicons with laravel 5.4.

I have the following questions:

1) When i run "npm run dev" glyphicon files are copied to public/fonts/vendor/bootstrap-sass/bootstrap. Where does this happen and can i change the path? I don't have not explicitly configured this in my webpack:

const { mix } = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css');

2) If i want to link previously mentioned glyphicons in my css i add the following line to my _variables.scss:

$icon-font-path: "/fonts/vendor/bootstrap-sass/bootstrap/";

But the problem is that my browser cant find the resources:

GET https://localhost/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.woff2 net::ERR_ABORTED

And that i because the resources are really located at:

https://localhost/MYAPP/PUBLIC/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.woff2

How can i make the path in my scss relative?

3) When i moved glypicon files to localhost/fonts just to test it out it worked. But after i added cachebusting to webpack it stopped working again.

mix.js('resources/assets/js/app.js', 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .version();

... and this happens because in css glypgicon files are also versioned:

src: url(/fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.eot?f4769f9bdb7466be65088239c12046d1);

But in reality it is not versioned. How can i solve this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire