Я использую usemin-cli
для минимизации моих HTML-файлов. Я установил все необходимые зависимости для использования usemin-cli
. Я пытаюсь выполнить следующий скрипт usemin
npm: -
"scripts": {
"start": "npm run watch:all",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server",
"scss": "node-sass -o css/ css/",
"watch:scss": "onchange './css/*.scss' -- npm run scss",
"watch:all": "parallelshell 'npm run watch:scss'",
"clean": "rimraf dist",
"copyfonts": "copyfiles -f node_modules/font-awesome/fonts/* dist/fonts",
"imagemin": "imagemin img/* --out-dir dist/img",
"usemin": "usemin index.html -d dist --htmlmin -o dist/index.html && usemin contactus.html -d dist --htmlmin -o dist/contactus.html && usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html",
"build": "npm run clean && npm run copyfonts && npm run imagemin && npm run usemin"
}
Он минимизирует index.html
и contactus.html
и выдает ошибку на aboutus.html
.
Вот aboutus.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie-edge">
<title>Ristorante Con Fusion: About Us</title>
<!-- build:css css/main.css -->
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="./node_modules/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="./node_modules/bootstrap-social/bootstrap-social.css">
<link rel="stylesheet" href="./css/styles.css">
<!-- endbuild -->
</head>
<body>
<!-- here is my body code using bootstrap and html -->
<!-- build:js js/main.js -->
<script src="./node_modules/jquery/dist/jquery.min.js"></script>
<script src="./node_modules/popper.js/dist/popper.min.js"></script>
<script src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="./js/scripts.js"></script>
<!-- endbuild -->
</body>
</html>
Вот index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie-edge">
<!-- build:css css/main.css -->
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="./node_modules/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="./node_modules/bootstrap-social/bootstrap-social.css">
<link rel="stylesheet" href="./css/styles.css">
<!-- endbuild -->
<title>Ristorante Con Fusion</title>
</head>
<body>
<!-- build:js js/main.js -->
<script src="./node_modules/jquery/dist/jquery.min.js"></script>
<script src="./node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="./js/scripts.js"></script>
<!-- endbuild -->
</body>
</html>
Ошибка запуска после npm run build
:
> usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html
undefined:1625
throw new JS_Parse_Error(message, filename, line, col, pos);
^
SyntaxError: Unexpected token: name (o)
at JS_Parse_Error.get (eval at <anonymous> (/home/neo/Desktop/full stack coursera/Web Ui with bootstrap(course1)/bootstrap4-starter/conFusion/node_modules/usemin/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:86:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion@1.0.0 usemin: `usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion@1.0.0 usemin script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/neo/.npm/_logs/2019-01-17T10_30_03_425Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! confusion@1.0.0 build: `npm run clean && npm run copyfonts && npm run imagemin && npm run usemin`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the confusion@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/neo/.npm/_logs/2019-01-17T10_30_03_525Z-debug.log
Что мне сделать, чтобы решить эту проблему?