Skip to content

Commit b5729ab

Browse files
author
yangfan19
committed
05 配置less@5.0.5
1 parent c6b86c0 commit b5729ab

File tree

5 files changed

+139
-1
lines changed

5 files changed

+139
-1
lines changed

webpack-05/package-lock.json

Lines changed: 127 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack-05/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"@babel/preset-react": "^7.12.13",
1717
"babel-loader": "^8.2.2",
1818
"css-loader": "^5.1.2",
19+
"less": "^4.1.1",
20+
"less-loader": "^5.0.0",
1921
"react": "^17.0.1",
2022
"react-dom": "^17.0.1",
2123
"style-loader": "^2.0.0",

webpack-05/src/search.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import React from 'react';
44
import ReactDOM from 'react-dom';
55

6-
import './search.css';
6+
// import './search.css';
7+
import './search01.less';
78

89
const Search = () => {
910
return <div className='box'>我是search组件</div>;

webpack-05/src/search01.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.box {
2+
font-size: 200px;
3+
color: blue;
4+
}

webpack-05/webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ module.exports = {
2323
test: /.css$/, // 配置css的后缀名
2424
use: ['style-loader', 'css-loader'], //tips:执行的顺序是右到左的
2525
},
26+
{
27+
test: /.less$/, // 配置less的后缀名
28+
use: ['style-loader', 'css-loader', 'less-loader'], //tips:执行的顺序是右到左的
29+
},
2630
],
2731
},
2832
};

0 commit comments

Comments
 (0)