SASS或LESS包装 [英] SASS or LESS packaging
问题描述
我想要从不同的目录导入我的scss或更少的文件(无论语言无关紧要)。目录在我的计算机上:
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
我试图避免.scss或.less中的相对路径文件以导入它们。我试图找到一个程序或方式我猜包装文件,而不必使用相对路径引用的scss或更少的文件的 @import
。是否有类似的东西,或者我需要考虑另一个文件结构?文件结构的整个点是为每个应用程序或网站,有一个参考点的库,而不是保留每个应用程序中的所有文件。
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提供了将库绑定到扩展名中的功能,以方便重用。他们在其网站上有关于如何构建扩展程序的教程: http:// compass-style。 org / help / tutorials / extensions /
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.
在您的项目的config.rb中添加对您的扩展的引用:
Add a reference to your extension in your project's config.rb:
require 'myextension'
如果您遵循Sass文件的推荐命名约定,则可以将它们导入任何Sass文件,如下所示: / p>
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
这篇关于SASS或LESS包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!