试图将我的.net核心jquery,bootstrap等从静态文件移动到package.json / npm更新。看来我需要吞咽或咕gr地做这项工作。但我找不到任何从堆栈或其他地方的例子。有人能举一个例子或一个网站吗?
使您的移动/迁移尽可能轻松而轻松的最佳方法是使用Libman for Asp.Net Core,该工具操作起来很简单。
它只需要您指定所需库的名称和输出文件夹,同时允许您选择要复制的文件而不是整个库。
这种方法的好处是它具有vs集成功能,并在您键入时提供智能感知。
编写一项gulp任务,将所需文件从npm文件夹移至wwwroot文件夹。
假设您已经安装了gulpfile,请安装一个名为gulp-rename的附加模块
npm i gulp-rename --save-dev
范例:
var rename = require('gulp-rename');
var staticFiles = [
'./node_modules/jQuery/dist/**/*.js',
'./node_modules/bootstrap/dist/**/*.{js,css}'
];
gulp.task('npmModules', function(){
// the base option sets the relative root for the set of files,
// preserving the folder structure
return gulp.src(staticFiles, { base: './' })
.pipe(rename(path => path.dirname = path.dirname.replace('node_modules', '')))
.pipe(gulp.dest('wwwroot/dist/'));
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句