案例的实现步骤:
- 创建两个正则表达式,分别匹配<style>和<script>标签
- 使用fs模块,读取需要被处理的html文件
- 自定义resolveCSS文件,来写入index.css样式文件
- 自定义resolveJS文件,来写入index.js文件
- 自定义resolveHTML文件,来写入index.html文件
时钟网页
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>index首页</title>
<style>
html,
body {
margin: 0;
padding: 0;
height: 100%;
background-image: linear-gradient(to bottom right, red, gold);
}
.box {
width: 400px;
height: 250px;
background-color: rgba(255, 255, 255, 0.6);
border-radius: 6px;
position: absolute;
le