Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programtic creation of variables from python #91

Open
glenfletcher opened this issue Jul 2, 2017 · 0 comments
Open

Programtic creation of variables from python #91

glenfletcher opened this issue Jul 2, 2017 · 0 comments

Comments

@glenfletcher
Copy link

After scanning through the code I'm not certain that this feature doesn't already exist, If it dose it obscure and undocumented, however I don't think its actually been implemented.

If its all ready possible to do this how to do so should be documented.

As for what I think this feature should be it the ability to pass a dict of less variables to the compile function, along with python functions for creating and manipulating these variables, some of these functions do exist, but they appear to be undocumented internal functions for handling the equivalent functions calls in the less code it self.

current compile sig:
def compile(file, minify=False, xminify=False, tabs=False, spaces=True):

suggested sig:
def compile(file, minify=False, xminify=False, tabs=False, spaces=True, variables={}):

suggested ussage:

compile(path_to_compile, variables={
  'bg-color': colors.rgb(50,60,120),
  'fg-color': colors.hsl(90, 75, 40),
  'banner-image': image_url
})

This would provide for the usage of less as a template system for CSS with dynamic content generations, for example a CMS with several parameters for defining the sites colour scheme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant