less - Loop through files in a directory or a list -


i trying generate multiple css classes single .css file used body element of page change page's entire color scheme.

i have folder of .less files containing variables @base00 @base0f specific color scheme (https://github.com/andrewbelt/hack.chat/tree/master/client/base16) , import each of these files each css class name.

here's psuedocode achieve need.

// syntax not exist in less each @scheme in ./base16/ {     @import "@scheme"      body.@{scheme} {         background: @base00;         color: @base07;     }      ... } 

i might have think outside of box one, creating makefile build replacing variable command line , concatenate each .css file generated less single master .css file. perhaps there more elegant way using pure less.

no, there's no built-in file system functions/features less. (it's designed work in several environments , of not permit "directory sniffing"). if necessary 1 can write plugin provide such functionality, suppose in case more easy externally.

compiling , concatenating multiple files not necessary simplest method. example can generate less file imports schemes , applies each main template, e.g. list of:

.scheme-name {     @import "scheme-name";     @import (multiple) "scheme-styles-template"; } 

statements. scheme-styles-template same scheme.less except body defined as:

body& {     background: @base00;     color: @base05; } 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -