Leo*_*ban 12 javascript build npm package.json npm-scripts
"scripts": {
"build": "webpack",
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"build:css": "node-sass --output-style compressed --include-path scss scss/lifeleveler.scss app/assets/css/app.css",
"build:css-expand": "node-sass --include-path scss scss/lifeleveler.scss app/assets/css/app.css",
"watch:css": "nodemon -e scss -x \"npm run build:css\"",
"watch:css:expand": "nodemon -e scss -x \"npm run build:css-expand\"",
"build:js": "browserify dist/main.js > dist/lifeleveler.app.js",
"watch": "npm run watch:css & npm run watch:js",
"watch:js": "onchange '/dist/**/*.js' -p -- npm run build:js"
},
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用1个watch运行lite服务器的脚本,构建.ts .js和.css文件.
现在,我有systemJS和tsc,当我修改或作出任何新的打字稿文件生成.js文件.
一旦这些javascript文件从中生成tsc:w,它们最终会出现在dist文件夹中.一旦它们更新到那里我想uglify并将它们连接到一个lifeleveler.app.js文件,基于dist里面的main.js.
到目前为止,我无法正确组合我的任务.
我的文件夹目录
我也在想我的方法是错的,我可以有2个终端窗口.1观看TSX - > js,另一个观看SASS-> CSS.
然后在最后,当我准备推动构建时,或许我的build:js任务.
但是我需要替换index.html文件中的块,你会怎么做?
<html>
<head>
<meta charset="UTF-8">
<title>LifeLeveler</title>
<meta name="description" content="Level up in the journey of life.">
<link rel="stylesheet" href="app/assets/css/app.css">
<!-- load the dependecies -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<!-- load our angular app with systemjs -->
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err) { console.log(err); });
</script>
<!-- <script src="dist/lifeleveler.app.js"></script> -->
</head>
<body class="container">
<my-app></my-app>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"rootDir": "app/",
"outFile": "./dist/main.js",
"outDir": "dist"
},
"sourceMap": true
Run Code Online (Sandbox Code Playgroud)
您可以修改您的tsconfig.json:
{
"compilerOptions": {
"target": "ES5",
"rootDir": "app/",
"outFile": "./dist/main.js"
}
}
Run Code Online (Sandbox Code Playgroud)
首先使用tsc:w编译成单个文件,并build:js缩小到dist/lifeleveler.app.js
编辑:请注意outFile不能与一起使用"module": "commonjs",请参阅此问题
| 归档时间: |
|
| 查看次数: |
1501 次 |
| 最近记录: |