February 2008 Blog Postings
How to manage and organize your Sass files
Posted by Mike Scriber on Friday, February 22, 2008
First of all when it comes to organization of your Sass, it's a good idea to have a solid framework laid out. Once you have a framework laid out you can re-use this for your other projects. I like to use this basic framework:
- base.sass
- structure.sass
- styles.sass
- forms.sass
- variables.sass - This can be it's own file or in base.sass depending on how many variables you will have.
You can add files to this as well if you feel it's necessary, but this is a great start to Sass organization. When it comes to calling all these files I usually import them into the base.sass file at the bottom. The reason for this is because Sass will write the imports above all your base styles. This brings me to the import feature.
Import is ve
... read more.Accessing view helpers in your controller
Posted by Mike Scriber on Friday, February 22, 2008
Today I had an interesting dilemma come about, which was using the text helper truncate and pluralize within a controller.
I’ve come across a solution from Lars Pind, which opens up the module and makes them module methods. Follow the steps below and you’ll be on your way to using text helper methods within your controllers in just a few minutes.
Step One
Create actionpack_ext.rb in your /lib directory. You can name this file anything you would like.
Step Two
Copy below code snippet into actionpack_ext.rb
module ActionView
module Helpers
module TextHelper
module_function :pluralize, :truncate
end
end
end ... read more.
Search Site
About Mike
Mike Scriber is a front-end developer located in Toronto and Waterloo, Ontario. Mike takes pride in knowing his work is usable, accessible and standard compliant.