Przeglądaj źródła

整理目录解构

DESKTOP-MK04A0R\chuck 3 lat temu
rodzic
commit
f2ba276182

+ 1 - 1
08/src/iconfont.css → 08/src/css/iconfont.css

@@ -1,6 +1,6 @@
 @font-face {
   font-family: "iconfont"; /* Project id  */
-  src: url('iconfont.ttf?t=1628229149554') format('truetype');
+  src: url('../media/iconfont.ttf?t=1628229149554') format('truetype');
 }
 
 .iconfont {

+ 1 - 1
08/src/index.less → 08/src/css/index.less

@@ -1,7 +1,7 @@
 #box{
     width:100px;
     height:100px;
-    background-image:url('./2.jpeg');
+    background-image:url('../imgs/2.jpeg');
     background-repeat: no-repeat;
     background-size:100% 100%;
 }

+ 0 - 0
08/src/1.jpeg → 08/src/imgs/1.jpeg


+ 0 - 0
08/src/2.jpeg → 08/src/imgs/2.jpeg


+ 0 - 0
08/src/3.jpeg → 08/src/imgs/3.jpeg


+ 1 - 1
08/src/index.html

@@ -11,7 +11,7 @@
     <span class="iconfont icon-anquanyinsi"></span>
     <span class="iconfont icon-anquanyinsi"></span>
     <span class="iconfont icon-cangchucangku"></span>
-    <img src="./1.jpeg">
+    <img src="./imgs/1.jpeg">
     <div id="box"></div>
 </body>
 </html>

+ 0 - 7
08/src/index.js

@@ -1,7 +0,0 @@
-import './iconfont.css'
-import './index.less'
-
-function add(x,y){
-    return x+y;
-}
-console.log(add(2,3))

+ 7 - 0
08/src/js/index.js

@@ -0,0 +1,7 @@
+import '../css/iconfont.css'
+import '../css/index.less'
+
+function add(x,y){
+    return x+y;
+}
+console.log(add(2,3))

+ 0 - 0
08/src/iconfont.js → 08/src/media/iconfont.js


+ 0 - 0
08/src/iconfont.json → 08/src/media/iconfont.json


+ 0 - 0
08/src/iconfont.ttf → 08/src/media/iconfont.ttf


+ 6 - 4
08/webpack.config.js

@@ -3,9 +3,9 @@ const {resolve} = require('path');
 const HtmlWebpackPlugin = require('html-webpack-plugin');
 
 module.exports = {
-    entry : './src/index.js',
+    entry : './src/js/index.js',
     output:{
-        filename: 'built.js',
+        filename: 'js/built.js',
         path: resolve(__dirname,'build')
     },
     module:{
@@ -27,7 +27,8 @@ module.exports = {
                 options:{
                     limit:8*1024,
                     name:'[hash:10].[ext]',
-                    esModule:false
+                    esModule:false,
+                    outputPath: 'imgs'
                 },
                 type:'javascript/auto'
             },
@@ -42,7 +43,8 @@ module.exports = {
                 loader:'file-loader',
                 options:{
                     name:'[hash:10].[ext]',
-                    esModule:false
+                    esModule:false,
+                    outputPath: 'media'
                 },
                 type:'javascript/auto'
             }

+ 1 - 0
package.json

@@ -7,6 +7,7 @@
     "file-loader": "^6.2.0",
     "html-loader": "^2.1.2",
     "html-webpack-plugin": "^5.3.2",
+    "http-server": "^0.12.3",
     "less": "^4.1.1",
     "less-loader": "^10.0.1",
     "style-loader": "^3.2.1",