Import default.less from ant-design using webpack and using in .ts files
Idea is to leverage the existing variables defined by library antd for default fonts and other useful predefined stuff.
I was wondering if there is any way to use those default.less
using webpack. The challenge I'm facing is the path conflict that is mentioned in most of the docs and second how to do that for .ts
files.
For example reading somewhere in customization of theme article, I read
new webpack.NormalModuleReplacementPlugin( /node_modules/antd/lib/style/index.less/, path.resolve(rootDir, 'src/myStylesReplacement.less') )
That's not the process to do but my hint is at - node_modules/antd/lib/style/index.less
path. Current directory structure of ant-design has this under node_modules
@ant-design
- icons
- icons-react
I'll not go further into tree, but you see the difference right there. Did I look further into it? Yes, but I couldn't find any styles folder in the root but in components itself only.
So my question is what is the updated way to import default.less
or other .less
files from antd
via webpack less-loader?
Although, I could have used .less
files in .js
files via webpack less-loader
loader but using is .ts
is a further question mark
Reading these already posted questions do not provide answer to do that in .ts
files.
How to require/import .less file in typescript file
how to import LESS files from specific path using webpack less-loader?
Until then, I'm just doing this inside my [components].tsx
const headStyles = {
background: "rgba(0,0,0,0.3)"
}
webpack antd
add a comment |
Idea is to leverage the existing variables defined by library antd for default fonts and other useful predefined stuff.
I was wondering if there is any way to use those default.less
using webpack. The challenge I'm facing is the path conflict that is mentioned in most of the docs and second how to do that for .ts
files.
For example reading somewhere in customization of theme article, I read
new webpack.NormalModuleReplacementPlugin( /node_modules/antd/lib/style/index.less/, path.resolve(rootDir, 'src/myStylesReplacement.less') )
That's not the process to do but my hint is at - node_modules/antd/lib/style/index.less
path. Current directory structure of ant-design has this under node_modules
@ant-design
- icons
- icons-react
I'll not go further into tree, but you see the difference right there. Did I look further into it? Yes, but I couldn't find any styles folder in the root but in components itself only.
So my question is what is the updated way to import default.less
or other .less
files from antd
via webpack less-loader?
Although, I could have used .less
files in .js
files via webpack less-loader
loader but using is .ts
is a further question mark
Reading these already posted questions do not provide answer to do that in .ts
files.
How to require/import .less file in typescript file
how to import LESS files from specific path using webpack less-loader?
Until then, I'm just doing this inside my [components].tsx
const headStyles = {
background: "rgba(0,0,0,0.3)"
}
webpack antd
add a comment |
Idea is to leverage the existing variables defined by library antd for default fonts and other useful predefined stuff.
I was wondering if there is any way to use those default.less
using webpack. The challenge I'm facing is the path conflict that is mentioned in most of the docs and second how to do that for .ts
files.
For example reading somewhere in customization of theme article, I read
new webpack.NormalModuleReplacementPlugin( /node_modules/antd/lib/style/index.less/, path.resolve(rootDir, 'src/myStylesReplacement.less') )
That's not the process to do but my hint is at - node_modules/antd/lib/style/index.less
path. Current directory structure of ant-design has this under node_modules
@ant-design
- icons
- icons-react
I'll not go further into tree, but you see the difference right there. Did I look further into it? Yes, but I couldn't find any styles folder in the root but in components itself only.
So my question is what is the updated way to import default.less
or other .less
files from antd
via webpack less-loader?
Although, I could have used .less
files in .js
files via webpack less-loader
loader but using is .ts
is a further question mark
Reading these already posted questions do not provide answer to do that in .ts
files.
How to require/import .less file in typescript file
how to import LESS files from specific path using webpack less-loader?
Until then, I'm just doing this inside my [components].tsx
const headStyles = {
background: "rgba(0,0,0,0.3)"
}
webpack antd
Idea is to leverage the existing variables defined by library antd for default fonts and other useful predefined stuff.
I was wondering if there is any way to use those default.less
using webpack. The challenge I'm facing is the path conflict that is mentioned in most of the docs and second how to do that for .ts
files.
For example reading somewhere in customization of theme article, I read
new webpack.NormalModuleReplacementPlugin( /node_modules/antd/lib/style/index.less/, path.resolve(rootDir, 'src/myStylesReplacement.less') )
That's not the process to do but my hint is at - node_modules/antd/lib/style/index.less
path. Current directory structure of ant-design has this under node_modules
@ant-design
- icons
- icons-react
I'll not go further into tree, but you see the difference right there. Did I look further into it? Yes, but I couldn't find any styles folder in the root but in components itself only.
So my question is what is the updated way to import default.less
or other .less
files from antd
via webpack less-loader?
Although, I could have used .less
files in .js
files via webpack less-loader
loader but using is .ts
is a further question mark
Reading these already posted questions do not provide answer to do that in .ts
files.
How to require/import .less file in typescript file
how to import LESS files from specific path using webpack less-loader?
Until then, I'm just doing this inside my [components].tsx
const headStyles = {
background: "rgba(0,0,0,0.3)"
}
webpack antd
webpack antd
edited Jan 2 at 13:59
kushalvm
asked Jan 2 at 13:36
kushalvmkushalvm
1,84162855
1,84162855
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You are looking in wrong directory. Check node_modules/antd
instead of node_modules/@ant-design.
There you will find the style
folder.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007365%2fimport-default-less-from-ant-design-using-webpack-and-using-in-ts-files%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are looking in wrong directory. Check node_modules/antd
instead of node_modules/@ant-design.
There you will find the style
folder.
add a comment |
You are looking in wrong directory. Check node_modules/antd
instead of node_modules/@ant-design.
There you will find the style
folder.
add a comment |
You are looking in wrong directory. Check node_modules/antd
instead of node_modules/@ant-design.
There you will find the style
folder.
You are looking in wrong directory. Check node_modules/antd
instead of node_modules/@ant-design.
There you will find the style
folder.
answered Mar 12 at 5:10
pszkvpszkv
12817
12817
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54007365%2fimport-default-less-from-ant-design-using-webpack-and-using-in-ts-files%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown