Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Support for @import ? #18

Closed
Martii opened this issue Jan 29, 2015 · 3 comments
Closed

Support for @import ? #18

Martii opened this issue Jan 29, 2015 · 3 comments

Comments

@Martii
Copy link

Martii commented Jan 29, 2015

Hello again. This is going to be a bit tricky to explain but I will give it a go in a reduced test case form...

someSnippet.js

var express = require('express');
var minify  = require('express-minify');

var app = express();

/*
 * Bunch of other express specific intialization and then...
 */
express.static.mime.define({
  'text/less': ['less']
});

/*
 * Use minify
 */
app.use(minify());

someSnippet.html

<link rel="stylesheet/less" type="text/css" href="/source1.less">

source1.less

@import 'source2.less';

body {
  background-color: @my-color;
}

source2.less

@my-color: #ABC123;

Produces the following output at our http://localhost:8080/source1.less:

{"type":"File","filename":"input","index":0,"line":1,"callLine":null,"column":0,"extract":[null,"@import 'source2.less';",""],"message":"'source2.less' wasn't found. Tried - source2.less,source2.less"}

... instead of the expected ...

body{background-color:#abc123}
  1. Did I do something incorrectly with express-minify initialization?
  2. Do you support the @import statement? Currently we are using the less-middleware package to achieve support.
  3. If you do support the @import statement we are going to need some exposure to the paths option in less too probably similar to Keep comments? #15 e.g. we currently pick through a series of .less files at different paths in our project tree and import them into our own .less from a different path.

As long as we don't use the @import statement and keep all variables and mixins in the same file express-minify works with less parsing and compiling... however splitting them out doesn't seem to.

Any help would be greatly appreciated.

@breezewish breezewish added the NFR label Feb 2, 2015
@breezewish
Copy link
Owner

Actually this is a hard problem, cause we don't know what is the FileSystem location only based on req. Any ideas?

@breezewish
Copy link
Owner

New ideas: allowing users to specify a LESS instance so that he/she can get control with the working directory configurations.

@breezewish
Copy link
Owner

You can specify LESS options now.

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

No branches or pull requests

2 participants