문제

I'm looking at this google guide, which suggests for example:

"Separate selectors and declarations by new lines."

"Indent all block content, that is rules within rules as well as declarations, so to reflect hierarchy and improve understanding."

And so forth.

But at the same time, Google suggests you minify your code here.

  1. Isn't this contradicting? Or are Google's suggestions in the first guide are only meant for the creation phase of the code, rather than the phase when it's already online?

  2. Also, If I minify a file, do I have to change its ending from style.css to style.min.css? I see many minified .js and .css files that come like this. Is it vital, or is that just to indicate to developers that if they want to modify the file, they better work on the non minified version first, and later minify it on their own?

도움이 되었습니까?

해결책

Or are Google's suggestions in the first guide are only meant for the creation phase of the code, rather than the phase when it's already online?

Yes. Minify when you publish the site.

Also, If I minify a file, do I have to change its ending from style.css to style.min.css?

No. That is just a convention for when you distribute minified files with development files.

다른 팁

Minification is only to save bandwidth when transferring the file over the network. It has no other purpose. A minified file is virtually impossible to work with for humans, so you're never going to minify the primary file you want to work on. You'll always create a minified copy of your actual file to send over the network, but you will not modify this copy by hand nor is anyone except a computer supposed to read it.

1- Isn't this contradicting? Or are Google's suggestions in the first guide are only meant for the creation phase of the code, rather than the phase when it's already online?

No, is not contradicting. Those suggestions are only meant for the development files. The production ready files usually are minified since that operation can save a lot of bandwidth across all files you may have, let say .css and .js but then readability will be lost (which is not needed in production anyways).

2- Also, If I minify a file, do I have to change its ending from style.css to style.min.css? I see many minified .js and .css files that come like this. Is it vital, or is that just to indicate to developers that if they want to modify the file, they better work on the non minified version first, and later minify it on their own?

No, you don't have to, for instance, you can have only one set of names for your development and production files, but it is a common convention (a good one) to have .min. files to easen the building and distributing of the files.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top