Less
less css extension for glim framework
less is an extension for glim framework to compile less files during the web server start. It uses less npm module to compile less source from command line.
Installation
- install less from npm
npm install -g less
Configuration
- Add the following config to the extensions config;
# app/config/<env>.py
config = {
'extensions' : {
'less': {
'source': os.path.join(paths.APP_PATH, 'assets/less/app.less'),
'destination': os.path.join(paths.APP_PATH, 'assets/css/app.css'),
'options': [
'compress',
'lint',
'nojs',
'units'
]
}
},
# ...
}
- The default configuration is the following;
DEFAULT_CONFIG = {
'source': os.path.join(paths.APP_PATH, 'assets/less/main.less'),
'destination': os.path.join(paths.APP_PATH, 'assets/css/main.css'),
'options': [
'lint',
'units',
'verbose'
]
}
Usage
- put a main.less file and add some styles
- add main.css import to your html sources
- start the web server
<html>
<head>
<link rel="stylesheet" type="text/css" href="/assets/css/main.css">
</head>
</html>
Roadmap
- Autocompile after file changes without web server start
- Show less errors on werkzeug served page
Updated less than a minute ago