ionic-framework - ionicserve 在ionic 2 中执行什么?

标签 ionic-framework gulp webpack ionic2

我一直在尝试添加一个 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 or ionic 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/

相关文章:

cordova - ionic 2 InAppBrowser url 未打开

javascript - 如何使用 Gulp 编译一堆 sass 文件并将其移动到另一个文件夹?

javascript - gulp.series() 不运行任务

javascript - syntaxhighlighter - Building : loadReposFromCache(. ..).error 不是函数

javascript - 如何使用 Webpack 延迟加载外部模块?

typescript - 我收到错误信息,polyfills-es2015.js:4001未处理的 promise 拒绝:指定的音频ID不存在引用。 ;区域:<root>;任务

azure - 请求 Azure 指标数据时为 "AuthorizationFailed"

webpack - vue.js 应用程序中静态 Assets 的路径

android - 如何让 Ionic 4 在 Android 5.1 上运行

javascript - 找不到模块 'path'