G
G
Grigory Vasilkov2016-07-17 20:06:58
HTML
Grigory Vasilkov, 2016-07-17 20:06:58

What to do with vendors when building a frontend? How to compress?

In order to please Google (holivar! 1111 urra), we need to compress all javascripts and styles into a single file.
Their files are compressed in general without any problems
Jokes come with vendors, as well as with additional files such as different fonts
How it looks:

/assets
-- /img
-- /stylus
-- /js
-- /fonts
-- /audio
-- /video
-- /ещеКакаяТоПапкаИНафигаОнаЗдесьВообще...

/dev
-- /img
-- /css
-- /js

/public
-- /img
-- /css
-- /js

Accordingly, at the exit after GULP (wow, what a maladEtz he is, let me hug)
in public and the maiden, then files are obtained. And if we allow links with images in CSS, you can write through tricks like
../../logo.jpg
That, the paths to the fonts that remain in the assets will no longer work
So, problems
1. In order for Google to like it, main.min.css / main.min.jsvendors must get into the file (I mean libraries, for example jquery, or there webhostinghub-glyphs, or fancybox) including, even if with the help of gulpa the scripts and styles from them are combined into one file along with my code, keeping the order, then the rest of the library remains in assets, and it is not in the public.
2. Trite fonts that are in assets, what, just copy them to devs and public (even if they are gulp)?
3. The paths that we will iron-hard sew into the layout will be on assets, then on public, then on dev, this is not comme il faut and not beautiful at all. Again, I wanted to work with the DEV version, I need to rewrite the paths for half the site
4. Due to our favorite (base href="/"), the relative paths for images, wired in the layout, will be a pitfall all the time.
5. Accordingly, if you connect libs simply through bower, then we do not solve the problem of "Google will like it", since we still connect two dozen scripts on the page through different script directives.
6. Again, in libs (vendors) written not by me, relative paths can come across, and when the library code is in a single file, relative paths will expect to find all related ones in the main folder, since the library turns out to have a public parent category.
What is the best way to organize this? What is where, and what is better not to touch at all?
I'm sure there are a lot of very smart guys here who have done this kind of thing a thousand times, please tell me!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-07-17
@sim3x

Use sass/less for plugins
In gulpa script use structure

/prod
  main.css
  main,css.map
  main.js
  main.js.map
....
  /img

this is how the paths will look like as a result
backgound: url('/img/bg.jpg')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question