I want to be able to import my scss or less file (either language doesn't matter) from different directories. The directories are this on my computer:
apps/myapp/includes/css/
&
framework/2.3/lib/framework/2.3/css
I am trying to avoid relative paths in the .scss or the .less files to import them. I am trying to find a program or a way I guess package the files without having to use relative path references on the @import
of the scss or less file. Is there something like that or do I need to think of another file structure? The whole point of the file structure is for each app or website that is made there is a reference point for the library instead of keeping all of the files within each app.
Compass for Sass offers the ability to bundle libraries into extensions for easy reuse. They have a tutorial on their site on how to build the extensions: http://compass-style.org/help/tutorials/extensions/
Using the extension in a project is a lot simpler than creating one.
Add a reference to your extension in your project's config.rb:
require 'myextension'
If you follow the recommended naming conventions for your Sass files, you can import them in any Sass file like so:
@import 'myextension';
@import 'myextension/specific/file';
Some existing Compass extensions:
- Sassy Buttons
- Color Schemer
- Modular Scale
Codekit for Mac has a feature called Frameworks:
Keep just one copy of a file on your drive and easily use it across many projects without worrying about file paths. No more copying files into every new site.
However, if you are using Compass (even with Codekit, I believe), you should follow cimmanon's advice and use Compass extensions. This is the solution I would recommend.