assemble / assemble-less

Grunt task for compiling LESS to CSS. This task does for less what Assemble does for HTML, making it much easier to modularize and reduce repetition in stylesheets.
http://github.com/assemble/assemble/
MIT License
66 stars 20 forks source link

How to use globalVars? #29

Open brunomacf opened 10 years ago

brunomacf commented 10 years ago

As documentation states the globalVars option prepend variables to the files. But i geting a parse error. The only file i use in assemble-less configuration is main.less that imports a variables.less where i use a template-directory-uri variable that i want to define in assemble-less config. This config is current like this:

less: {
            development: {
                files: {
                    'build/assets/main.css': 'less/main.less'
                },

                options: {
                    globalVars: {
                        'template-directory-uri': 'DEVELOPMENT URI'
                    }
                }
            },

            production: {
                files: {
                    'dist/assets/main.css': less/main.less'
                },

                options: {
                    globalVars: {
                        'template-directory-uri': 'PRODUCTION URI'
                    }
                }
            }
        },

and in the variable.less that is included i have:

@icon-font-path: "@{template-directory-uri}/assets/";

By the way, it would be nice if the process option was applied to every imported less files instead of just the files listed in files item. What do u think about it?

brunomacf commented 10 years ago

Ok....weird behavior! If the DEVELOPMENT URI is set to something like http://localhost i just state

'template-directory-uri': "  'http://localhost'  "

for some reason the "" was stripped of and cause a parse error beacuse the variable that is prepended is

@template-directory-uri: http://localhost

and not

@template-directory-uri: "http://localhost"

as it should be!! Weird though!