You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've just created a ticket on the Ruby bindings repo here cowboyd/less.rb#65 but thinking that the issue may come down to Less itself.
Less assumes that @import statements should look for a file on the filesystem, which is not always the case for example when their content is stored in a database.
Yep. You can write a file importer exactly as you describe by overriding the less.Parser.importer function. You'll notice in the browser build that the browser environment does just that.
However, that behavior is not currently consistent or centralized for all types of file operations. For instance, the data-uri handler assumes a Node file environment and does not have any of the same kinds of hooks as @import statements.
Moving forward, LESS will (hopefully) eventually have a more graceful environment plugin model that allows you to handle file operations however you wish.
Sorry for the delay. As far as your specific issue, writing a file importer is possible today. But I agree, there are places where there is a file request that doesn't actually use the same file import method. Reopening.
I should note that this importer was originally based on an older version of LESS when the API / callback / error-handling structure was all very different (although updated and somewhat tested with 1.5.1), so please don't take it as a best example. I'd love it if @lukeapage reviewed this.
Activity
matthew-dean commentedon Jun 30, 2013
Yep. You can write a file importer exactly as you describe by overriding the less.Parser.importer function. You'll notice in the browser build that the browser environment does just that.
However, that behavior is not currently consistent or centralized for all types of file operations. For instance, the data-uri handler assumes a Node file environment and does not have any of the same kinds of hooks as @import statements.
Moving forward, LESS will (hopefully) eventually have a more graceful environment plugin model that allows you to handle file operations however you wish.
matthew-dean commentedon Dec 15, 2013
Sorry for the delay. As far as your specific issue, writing a file importer is possible today. But I agree, there are places where there is a file request that doesn't actually use the same file import method. Reopening.
jonschlinkert commentedon Dec 15, 2013
I think this is a good call. agreed that this would be useful
matthew-dean commentedon Dec 21, 2013
Btw, if this helps, Crunch currently has an importer that looks like this:
You can create your importer, and basically do whatever you want in that operation. And then you just return the fileData to the callback.
matthew-dean commentedon Dec 21, 2013
I should note that this importer was originally based on an older version of LESS when the API / callback / error-handling structure was all very different (although updated and somewhat tested with 1.5.1), so please don't take it as a best example. I'd love it if @lukeapage reviewed this.
lukeapage commentedon Jan 4, 2015
You can now use less and plugin your own file manager which can handle file system calls.
http://lesscss.org/usage/#developing-less-how-to-run-less-in-other-environments
This was finished in v2.