Ionic 2.0.0-beta.24 如何在没有 ionic.config.js 的情况下导入 node_module css 文件
Ionic 2.0.0-beta.24 how can i import node_module css files without ionic.config.js
我正在尝试使用 ionic 2.0.0-beta.24 和 leaflet 0.7.7 设置基本的 ionic 2 leaflet 应用程序。使用
启动默认项目后
ionic start test --v2 --ts
如果您打开 ionic.config.js
文件,您将看到消息
Ionic CLI is no longer responsible for building your web assets, and now
relies on gulp hooks instead. This file was used for exposing web build
configuration and is no longer necessary.
If this file is executed when running ionic commands, then an update to the
CLI is needed.
If your version of the Ionic CLI is beta.21 or greater, you can delete this file.
在旧版本的 ionic 2 中,您可以像这样将要包含的目录放入此文件中:
sass: {
src: ['app/theme/app.+(ios|md).scss'],
dest: 'www/build/css',
include: [
'node_modules/ionic-framework',
'node_modules/ionicons/dist/scss',
'node_modules/leaflet/dist'
]
},
现在我想这不是一个选项,所以我如何引入我需要的 css 样式 sheet,因为在 app.core.scss
错误中执行 @import "leaflet";
out 因为找不到文件夹。
如有任何帮助,我们将不胜感激。我能够使用 Leaflet js 库,因为我做到了。
npm install --save leaflet
typings install --ambient --save leaflet
地图加载没有问题,但图块被打乱,这表明 css sheet 未加载。如果我输入样式 sheet link 它可以正常工作,但我宁愿不必依赖 CDN。
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
谢谢。
因此,通过发布这个问题,我开始追踪 ionic gulp sass-build task 的文档。
他们提供的例子很有帮助。如果我更新第 55 行附近的默认 gulpfile.js
代码:
gulp.task('sass', buildSass);
到
gulp.task('sass', function(){
return buildSass({
sassOptions: {
includePaths: [
'node_modules/ionic-angular',
'node_modules/ionicons/dist/scss',
'node_modules/leaflet/dist'
]
}
})
});
它解决了我的问题。我还需要在需要传单 css 的页面中调用 @import "leaflet"
。
我正在尝试使用 ionic 2.0.0-beta.24 和 leaflet 0.7.7 设置基本的 ionic 2 leaflet 应用程序。使用
启动默认项目后ionic start test --v2 --ts
如果您打开 ionic.config.js
文件,您将看到消息
Ionic CLI is no longer responsible for building your web assets, and now
relies on gulp hooks instead. This file was used for exposing web build
configuration and is no longer necessary.
If this file is executed when running ionic commands, then an update to the
CLI is needed.
If your version of the Ionic CLI is beta.21 or greater, you can delete this file.
在旧版本的 ionic 2 中,您可以像这样将要包含的目录放入此文件中:
sass: {
src: ['app/theme/app.+(ios|md).scss'],
dest: 'www/build/css',
include: [
'node_modules/ionic-framework',
'node_modules/ionicons/dist/scss',
'node_modules/leaflet/dist'
]
},
现在我想这不是一个选项,所以我如何引入我需要的 css 样式 sheet,因为在 app.core.scss
错误中执行 @import "leaflet";
out 因为找不到文件夹。
如有任何帮助,我们将不胜感激。我能够使用 Leaflet js 库,因为我做到了。
npm install --save leaflet
typings install --ambient --save leaflet
地图加载没有问题,但图块被打乱,这表明 css sheet 未加载。如果我输入样式 sheet link 它可以正常工作,但我宁愿不必依赖 CDN。
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
谢谢。
因此,通过发布这个问题,我开始追踪 ionic gulp sass-build task 的文档。
他们提供的例子很有帮助。如果我更新第 55 行附近的默认 gulpfile.js
代码:
gulp.task('sass', buildSass);
到
gulp.task('sass', function(){
return buildSass({
sassOptions: {
includePaths: [
'node_modules/ionic-angular',
'node_modules/ionicons/dist/scss',
'node_modules/leaflet/dist'
]
}
})
});
它解决了我的问题。我还需要在需要传单 css 的页面中调用 @import "leaflet"
。