A
A
Arman2015-10-19 14:54:03
Composer
Arman, 2015-10-19 14:54:03

What's the easiest way to publish (js/css/jpg) files from ./vendor?

Good day.
I'm looking for how to simplify my life =) I connect various libs to laravel 5.1 to the fullest. After running "php artisan vendor:publish", the configs are mostly copied, but the files remain in the vendor. I found a lib https://github.com/SerafimArts/Asset , which allows you to simply specify the path in the view to take a file from anywhere and cache it in a folder accessible from the web. Faced such a problem that css / js can look for pictures and other files in the same folder, which, respectively, are not there. Basically, everyone does preparatory actions to generate it all, or they copy everything themselves to the public folder with pens. I would like it to be somehow simpler, for example:
- specify the intermediary for the "/static" path
- the intermediary checks if there is such a file (? - perhaps not necessary, since the web server has already sent to php)
- if there is no file, then it looks at the rules that we set to search for the corresponding file and generates this file - it simply takes the files there, how you set it up. it can be local files or from some cdn. The only task is to take the files and put them in the cache to ourselves.
It turns out that we do not copy anything into the public folder by hand, upon request, the code generates files for itself.
Maybe someone met with such a problem? Did you find any ready solution? Tried to find for laravel, but there is absolutely nothing. Maybe not limited to laravel and is there some kind of global solution?
thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rustamka Vorontsov, 2015-10-22
@Arik

bower.io + Laravel Elixir why do ananism?
Copy a File to a New Location

elixir(function(mix) {
    mix.copy('vendor/foo/bar.css', 'public/css/bar.css');
});

Copy an Entire Directory to a New Location
elixir(function(mix) {
    mix.copy('vendor/package/views', 'resources/views');
});

E
ellrion, 2015-10-19
@ellrion

Such a problem should simply not be if you use normal packages written specifically for Lara. Since there are publishing methods laravel.com/docs/5.1/packages#public-assets. If you use third-party packages, then why not make a Provider for each one in which you can independently configure the publication of assets?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question