brunch / less-brunch

Adds LESS support to Brunch
14 stars 18 forks source link

LESS files don't get created as modules in the output Javascript file #41

Open samirotiv opened 7 years ago

samirotiv commented 7 years ago

Hi,

I have turned on modules: True in my brunch.config. Now, although CSS modules are created correctly for CSS files, the output of the less file is only the mapping of the name mangling. Modules are not created for the actual content of the LESS file.

brunch config:

exports.config = {
  // See http://brunch.io/#documentation for docs.
  files: {
    javascripts: {
      joinTo: {
        'vendor.js': /^node_modules/,
        'mobile.js': [/^app\/mobile/, /^app\/common/],
        'warroom.js': [/^app\/warroom/, /^app\/common/]
      },
      order: {
        after: [/\.html$/, /\.css$/]
      }
    },
    templates: {
      joinTo: {
        'mobile.js': [/^app\/mobile/, /^app\/common/],
        'warroom.js': [/^app\/warroom/, /^app\/common/], 
      }
    }
  },
  plugins: {
    css: {
      modules: true,
      cssModules: true
    }, 
    less: {
      modules: true,
      cssModules: true
    }
  }
};

Relevant snippet from warroom.js:

require.register("warroom/components/appComponent/app.component.less", function(exports, require, module) {
module.exports = {"pandafry":"_pandafry_c5j6n_1"};
});

app.component.less:

.pandafry {
  color: #beefad;
}

body {
  background-color: #bedead;
}

And there is no search match for beefad or bedead in warroom.js.

Whereas, CSS modules are correctly going into the output file warroom.js.

Example:

;require.register("warroom/components/dash-task/dash-task.component.css", function(exports, require, module) {
module.exports = "h1 {\n  background:black;\n  font-family: 'Times New Roman', Times, serif\n}"
});

Can somebody please help me find out what I'm doing wrong?

denysdovhan commented 7 years ago

@samirotiv hey, thanks for reporting! Let's see how can I solve your problem.

Could you, please, provide me a GitHub repo that reproduce your problem? That would help me a lot.