How to use less mixins in meteor with @import and not get multiple definitions

in my current meteor app I have split the less declarations in one file per Controller (iron-router). I have a common file - where I have defined some mixins - which is imported in each less file. My problem is that the classes are imported multiple times in each route.

The file structure is:

mixins.import.less (new names, reference http://docs.meteor.com/#less)

.grid-container {
    // something
}

postList.less

@import (once) url('/client/views/mixins.import.less');

postDetail.less

@import (once) url('/client/views/mixins.import.less');

Then in the Chrome inspector I found duplicated everything I have written in mixins.import.less. Is it possible to avoid this double import?

Answers


Assuming you want the mixin code at least once in your compiled css (perhaps not, some just want them as mixins, not classes in the css code), then make sure you set it to bring in the "mixins.import.less" file all by itself. Then for all your dependent files using it, do this:

"postList.less", "postDetail.less", etc.

@import (reference) url('/client/views/mixins.import.less');

The (reference) option has been available since LESS 1.5, and will only bring in the code for reference purposes to be used in the LESS file, but will not itself output any css.


Need Your Help

ANT - Converting a String to Path with location attribute

ant location classpath pathelement

I have the following ANT script that gives me a list of websphere libraries at runtime based on the websphere root directory. I need to convert the resulting string into separate path location ele...

mysql returned an empty result set upon executing a trigger

mysql triggers

i am trying to create a trigger but i do not know why I am getting this message. am i doing the right this or am I doing something wrong? when I try to run the trigger im getting a message like

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.