/server-less-loader

replace server-side less import statement to webpack require.

Primary LanguageJavaScript

server-less-loader Build Status

replace server-side less import statement to webpack require.

Installation

$ npm install server-less-loader --save-dev

How to use

add server-less-loader before any js-related loader

{
    test: /\.babel$/,
    loader: "babel!server-less-loader"
},

add serverLessLoader option in webpack.config.js

serverLessLoader: {
    loader: 'importLess' // use any word except for 'require'
}

Before:

import React from 'react';
var styleFile = importLess('./a', __dirname);

export default class a extends React.Component {
...

After:

import React from 'react';
var styleFile = require('./a.less');

export default class a extends React.Component {
...