librelist archives

« back to archive

@import less file from other blueprint.

@import less file from other blueprint.

From:
lynadge
Date:
2013-05-07 @ 15:42
Hi,

i had a standard flask project and for some basic files i use a "base" 
blueprint. In this, i put some useful scripts and so on.

For example:
--------------------------------
| myapp
| static
| less
| style.less
| base_blueprint
| static
| less
| variables.less
--------------------------------

In this example i want to `@import 
'/base_blueprint/static/less/variables.less';` in the file 
`/static/less/style.less`.

But, what is the correct path?

Ask, if you need more information. I think, thats all.

Re: [flask] @import less file from other blueprint.

From:
Spacelee
Date:
2013-05-08 @ 00:02
What about setting up the PYTHONPATH="parent dir of static" env , and then
from base_blueprint.static.less.variables import less
make sure in each directory, you have __init__.py already.


On Tue, May 7, 2013 at 11:42 PM, lynadge <lynadge@barfooz.de> wrote:

> Hi,
>
> i had a standard flask project and for some basic files i use a "base"
> blueprint. In this, i put some useful scripts and so on.
>
> For example:
> --------------------------------
> | myapp
> | static
> | less
> | style.less
> | base_blueprint
> | static
> | less
> | variables.less
> --------------------------------
>
> In this example i want to `@import
> '/base_blueprint/static/less/variables.less';` in the file
> `/static/less/style.less`.
>
> But, what is the correct path?
>
> Ask, if you need more information. I think, thats all.
>



-- 
*Space Lee*

Re: [flask] @import less file from other blueprint.

From:
lynadge
Date:
2013-05-12 @ 15:57
Don't get me wrong, i try to import via less. Not via Python.

In lesscss i try to import a less file from another blueprint. Actually 
there is no python in my problem.

Am 2013-05-08 01:02, schrieb Spacelee:
> What about setting up the PYTHONPATH="parent dir of static" env , and 
> thenĀ 
> from base_blueprint.static.less.variables import less
> make sure in each directory, you have __init__.py already.
> 
> On Tue, May 7, 2013 at 11:42 PM, lynadge <lynadge@barfooz.de> wrote:
> 
> Hi,
> 
> i had a standard flask project and for some basic files i use a "base"
> blueprint. In this, i put some useful scripts and so on.
> 
> For example:
> --------------------------------
> | myapp
> | static
> | less
> | style.less
> | base_blueprint
> | static
> | less
> | variables.less
> --------------------------------
> 
> In this example i want to `@import
> '/base_blueprint/static/less/variables.less';` in the file
> `/static/less/style.less`.
> 
> But, what is the correct path?
> 
> Ask, if you need more information. I think, thats all.
> 
> --
> 
> SPACE LEE

Re: [flask] @import less file from other blueprint.

From:
Steven Kryskalla
Date:
2013-05-12 @ 17:32
On Sun, May 12, 2013 at 8:57 AM, lynadge <lynadge@barfooz.de> wrote:
> Don't get me wrong, i try to import via less. Not via Python.
>
> In lesscss i try to import a less file from another blueprint. Actually
> there is no python in my problem.

The spaces got removed from your first email, so I can't see which
file is under which folder, but I'm guessing you need to go up a few
directories from static/less/style.less, like this:

'../base_blueprint/static/less/variables.less'
'../../base_blueprint/static/less/variables.less'
'../../../base_blueprint/static/less/variables.less'
etc.

The less docs also say you can do this:

"""
You may pass some options to the compiler:

var parser = new(less.Parser)({
    paths: ['.', './lib'], // Specify search paths for @import directives
    filename: 'style.less' // Specify a filename, for better error messages
});
"""

Perhaps you could pass in the path to the blueprints in the 'paths'
option there.

Re: [flask] @import less file from other blueprint.

From:
lynadge
Date:
2013-05-12 @ 18:31
Nice. I thought so that it would similiar to django. In django i use the 
same approach.

With this path it will work: "@import 
'../../base/_blueprint/static/less/variables.less';"

To serve the less files i use flask-webassets.

Thanks! :)

Am 2013-05-12 18:32, schrieb Steven Kryskalla:
> On Sun, May 12, 2013 at 8:57 AM, lynadge <lynadge@barfooz.de> wrote:
> Don't get me wrong, i try to import via less. Not via Python.
> 
> In lesscss i try to import a less file from another blueprint. Actually
> there is no python in my problem.
> 
> The spaces got removed from your first email, so I can't see which
> file is under which folder, but I'm guessing you need to go up a few
> directories from static/less/style.less, like this:
> 
> '../base_blueprint/static/less/variables.less'
> '../../base_blueprint/static/less/variables.less'
> '../../../base_blueprint/static/less/variables.less'
> etc.
> 
> The less docs also say you can do this:
> 
> """
> You may pass some options to the compiler:
> 
> var parser = new(less.Parser)({
> paths: ['.', './lib'], // Specify search paths for @import directives
> filename: 'style.less' // Specify a filename, for better error messages
> });
> """
> 
> Perhaps you could pass in the path to the blueprints in the 'paths'
> option there.