"Grund" is "foundation" in Swedish. This is my own SCSS foundation I start out new projects from. It's built with Compass in mind, but that dependency can be easily pulled out.
Since I'm tired of setting up the same file structure for every new project. I find myself copying over the same files and snippets all over again. Having these resources in a repository is great for collaboration, learning and developing good practices.
Building modular reusable CSS is hard. Thanks to SCSS we are able to do some more fancy work, but when developing a semi-large project it's important to have structure and a way of thinking.
I've written a post on the subject some time ago which you should read: "Bringing order to CSS".
There are a couple of ways:
I've created a RubyGem for easy installations of Grund. You didn't think I'd create a reusable CSS foundation without a quick way of putting it into a new project, did you?
gem install grund
grund install
It'll pull down the files in this repo and put it in the current directory. Run grund help
for brief info. The repository for the CLI client is located here: github.com/johanbrook/grund.
Download the ZIP file with the files.
git clone git://github.com/johanbrook/grund.css.git
For development, forking, etc.
The sass-globbing gem lets you include whole trees of Scss files. Se _main.scss
. Thus, all files in the directories common
, partials
, and views
will be auto imported in _main.scss
.
Install sass-globbing
with
gem install sass-globbing
common
. I usually put common stuff in .. yeah,common
. It may be general, site wide things like styles for buttons, forms, headings, modal boxes, etc.lib
. In here, styles which potentially can be re-used in different projects should live. General helpers, mixins, font definitions, animations, etc.partials
. Here I put styles for different regions of the site, such as header, footer, articles, etc.views
contains a Scss file for each major view of the site. Could be structured in nested directories, thanks tosass-globbing
.viewports
contains files with media queries. Must be explicitly imported in_main.scss
.
Contributions, tips and suggestions are welcomed! CSS is a living thing – new best practices develops, and while I'd like to keep the bloat down, it would be great to learn how others are doing it.
Copyright © 2012 Johan Brook, http://johanbrook.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.