LESS instead of CSS

2

I have a question about the server part where the rendering of the styles, at least with Chrome and FireFox.

And they use the .LESS instead of the .CSS. In development it's good to show them to me, since it's so much easier to know what to touch up if needed.

What I do not understand is why in the environment of the non-development server where I only upload the .CSS is taking these .LESS files (and also, they are not updated to the latest version).

Use GULP, gulp-less, gulp-autoprefixer, gulp-sourcemaps and browser-sync. These files are also not uploaded to the server environment.

I do not know if this happened to someone else, but it's something I do not like very much that happens, especially if it's not updated when everything is under development.

    
asked by Cheshire 16.03.2018 в 11:38
source

1 answer

2

Browsers do not use LESS files, they use CSS. But there are the so-called source maps . Surely your CSS file includes a comment type:

//# sourceMappingURL=/path/to/file.css.map

That tells your browser where to get that file. Or, directly, it introduces it as embedded binary:

/*# sourceMappingURL=data:application/json;base64,ewoJInZlcnNpb24iOiAzJImZpbGUi...

Which you should avoid in production because it means that you have put all the sources within the result file, and often this part is more important than the result itself.

In one way or another, with this information the browser is able to reconstruct the original file and allow you to debug by viewing your sources. This works for both CSS and Javascript: here is an example with Typescript that the Angular builder maps and offers to the browser:

    
answered by 16.03.2018 / 12:58
source