问题
In implementing foundation.css framework, shall I update the actual foundation.css for my custom needs (font colors, backgrounds, etc) or shall I use a secondary css for my customization so that when foundation.css needs updating I can replace it without losing my customization.
Let me know your thoughts on this strategy. This would be the code the second option above:
<link rel="stylesheet" href="css/foundation.css" media="screen, projection" />
<link rel="stylesheet" href="css/my-custom.css" media="screen, projection" />
Thank you
回答1:
Well I think this is more an opinion request than a real question. Still, I'd say the answer is, as always in these cases, it depends.
You can certainly override the original stylings with a second css, and I think that's what they suggested on their docs (haven't been using Foundation during the last, I think, 6 months, sorry). It will just work ok, and your future upgrades will be easier to integrate, in case the framework will get some. This is certainly a perfect future-proof approach.
Performance-wise I'd suggest to directly customise that very css. My reasons are:
- Less KB: Your css will be lighter = faster to load.
- Less DOM painting: the browser won't have to style elements the Foundation way and then style them again your way.
- Less HTTP requests: the browser will only download one css, saving one extra HTTP request (fater load time)
So, it's really up to you, as you're the only one who knows if the website will need a framework update. I never had the need of an update when I used Foundation, and I think it's been tested quite a lot that vital updates will hardly be needed.
来源:https://stackoverflow.com/questions/15261183/best-practices-for-modifying-foundation-css-framework