Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

compiler construction - SASS or LESS packaging

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...