使用Aurelia时,我在CSS上看到以下内容。
import 'bootstrap/css/bootstrap.css!';
我的问题是,您可以配置它以支持更少的文件吗?还是我们需要单独运行预处理器,首先将较少的文件转换为css文件?
提前致谢。
我认为您的问题很广泛,答案取决于您选择的解决方案。
该上手的Aerelia显示页面,您如何使用JSPM集成自举。某些源1,2建议到餐桌GitHub上的引导库,并与热蒙公司使用该定制叉代替原来的。在package.json
您的项目中,用您自己的jspm依赖项中的fork替换Bootstrap,或运行:
jspm install github:{username}/bootstrap@master
从长远来看,我希望以上内容会给您带来麻烦,无法让您的叉子保持最新状态。另外,您还必须编译Bootstrap(本地),并为每次更改将所做的更改推送到github。
或者,您确实可以下载Bootstrap并将“少编译”任务添加到项目的gulp构建任务中。正如@ matthew-james-davis在评论中已经建议的那样,您可以将AASS和Aurelia的Skeleton Navigation项目一起使用,以了解如何执行此操作。
我建议使用Bower在本地安装Bootstrap:
bower install bootstrap
上面将在bower_components/bootstrap
文件夹中安装引导程序。不要直接修改这些文件。创建一个less/project.less
:
@import "bootstrap";
// your custom code here
请注意,编译Bootstrap时也需要autoprefix css处理器。另请参阅:http : //bassjobsen.weblogs.fm/compile-bootstrap-less-v2-autoprefix-plugin/
因此,您的gulp构建任务应如下图所示:
var LessPluginCleanCSS = require('less-plugin-clean-css'),
LessPluginAutoPrefix = require('less-plugin-autoprefix'),
cleancss = new LessPluginCleanCSS({ advanced: true }),
autoprefix= new LessPluginAutoPrefix({ browsers: ["Android 2.3,Android >= 4,Chrome >= 20,Firefox >= 24,Explorer >= 8,iOS >= 6,Opera >= 12,Safari >= 6"] });
gulp.task('build-less', function() {
gulp.src('less/project.less')
.pipe(sourcemaps.init())
.pipe(less({
plugins: [autoprefix, cleancss],
paths: [ path.join(__dirname, 'bower_components/bootstrap/less/') ]
}))
.pipe(sourcemaps.write(paths.sourceMapRelativePath))
.pipe(gulp.dest('css/'))
});
上面的任务应编译,css/project.css
您可以在index.html
项目的中引用此文件:
<link rel="stylesheet" type="text/css" href="css/project.css">
您还必须加载Bootstrap Javascripts插件。这些插件取决于jQuery。bootstrap.min.js
来自bower_component文件夹的链接。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句