Skip to content

Instantly share code, notes, and snippets.

@aliustaoglu
Created May 2, 2018 20:48
Show Gist options
  • Save aliustaoglu/a4c5b5f035e996823cc6335ebe0d0ee5 to your computer and use it in GitHub Desktop.
Save aliustaoglu/a4c5b5f035e996823cc6335ebe0d0ee5 to your computer and use it in GitHub Desktop.
Customising Ant.design theme
{
"env": {
"test": {
"plugins": [
/* DON'T SET import Plugin for unit test environment if you're using JEST */
]
},
"development": {
"plugins": [
["import", { "libraryName": "antd", "libraryDirectory": "es"}]
]
},
"production": {
"plugins": [
["import", { "libraryName": "antd", "libraryDirectory": "es"}]
]
}
}
}
npm install --save-dev less less-loader css-loader style-loader

package.json ``json { "scripts": { "test": "set BABEL_ENV=test&& jest", "watch": "set BABEL_ENV=development&& webpack --watch -d", "build": "set BABEL_ENV=production&& webpack -p --config ./webpack.prod.config.js", } }

@import "~antd/dist/antd.less";
@import "my.ant.theme.scss";
import './themes/ant.less';
$font-family: Source Sans Pro;
module.exports = function (source) {
return source.replace(/\$/ig, '@');
};
const path = require('path');
const webpack = require('webpack');
module.exports = env => {
return {
/*
OTHER CONFIGURATION
*/
module: {
rules: [
/* OTHER RULES */
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.less$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{
loader: "less-loader",
options: {
javascriptEnabled: true
}
}
]
},
{
test: /\.scss$/,
issuer: {
exclude: /\.less$/,
}
},
{
test: /\.scss$/,
issuer: /\.less$/,
use: {
loader: './sassVarsToLess.js'
}
}
]
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment