我一直在尝试添加一个 gulp 任务来编译我正在创建的 jade 文件。
但是,当我运行 ionic serve
时,任务运行正常它不执行我创建的 gulp 任务
我假设 Ionic 正在使用 webpack,但是我想知道我需要做什么才能使我的新任务也正常工作
我得到的输出是:
➜ ionic git:(master) ✗ ionic serve
∆ Compiling and bundling with Webpack...
√ Using your webpack.config.js file
∆ Compiling Sass to CSS
√ Matching patterns: app/theme/app.+(ios|md|wp).scss
∆ Copying fonts
√ Matching patterns: node_modules/ionic-angular/fonts/**/*.+(ttf|woff|woff2)
∆ Copying HTML
√ Matching patterns: app/**/*.html
√ HTML copied to www/build
√ Sass compilation complete
最佳答案
根据有关 app-scripts 的 Ionic2 文档,他们决定不再在他们的项目中使用 gulp:
What About Gulp?
Historically Ionic apps have used gulp as tool to facilitate the build process. Over the years, gulp has seen less and less development, and has started to accumulate deprecation warnings. By taking advantage of standard and dependency free NPM scripts, we are reducing dependencies and simplifying the development experience.
相反,他们使用 Ionic 应用程序脚本,这实际上是用于构建过程的 npm 脚本。来自同一提到的文档:
When
ionic serve
orionic run
are invoked, it ultimately calls an NPM script. These npm scripts call the @ionic/app-scripts library to execute the build process.
要实现您的目标,即使用 Pug(以前称为 Jade)作为模板,您可以执行以下任一操作:
一:编写自定义应用脚本而不是 watch.config.js
。原始脚本可在 here on github 上找到。 .
二:写一个Cordova hook对于编译前。
作为引用,此答案写于 2016 年 11 月 12 日。
关于ionic-framework - ionicserve 在ionic 2 中执行什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36074391/