emberfeather/less.js-middleware

Import paths option doesn't work

Closed this issue · 2 comments

I am using this middleware with express and semantic-ui-less npm package.

This middleware is configured as below:

app.use(require('less-middleware')(path.join(__dirname, 'public', 'stylesheets'), {
  debug: true,
  dest: path.join(__dirname, 'public', 'stylesheets'),
  render: {
    paths: [ path.join(__dirname, 'node_modules', 'semantic-ui-less') ]
  }
}));

Then i use @import "semantic"; in my style.less file to import semantic ui. However it can't find the file even though it exists at the path specified through options.

Then i tried this way:

app.use(require('less-middleware')(path.join(__dirname, 'public', 'stylesheets'), {
  debug: true,
  dest: path.join(__dirname, 'public', 'stylesheets'),
  preprocess: {
    importPaths: function(paths, req) {
      return paths.push(path.join(__dirname, 'node_modules', 'semantic-ui-less'));
    }
}));

This doesn't work either, actually the 2nd version never even calls the ImportPaths function as i tried placing a console.log in it.

Can you tell me what is happening? Cause i don't think both of them can be broken lol.

Hi, sorry for the long delay. Were you able to get the import paths working? Looking at the code and tests the importPath should be getting called correctly. I can put a log statement in the function and see it in the output. So it is strange that it is not being called.

I moved away from that project, don't recall if i got it working or not. Been about 6 months i posted that lol.