I havew created a new Asp.net core project and im trying to install Knockout.js, im doing so by following Knockoutjs install
我已经创建了一个新的Asp.net核心项目,我试图安装Knockout.js,我这样做是通过遵循Knockoutjs安装
Problem is, i add the knockout to my bower (latest version 3.4.0 not 3.3.0).
问题是,我将淘汰赛添加到我的凉亭(最新版本3.4.0而不是3.3.0)。
"knockout": "^3.4.0"
}
I hit save, then go to the wwwroot/lib folder and Knockout folder is there. However it looks like this ...
我点击保存,然后转到wwwroot / lib文件夹,Knockout文件夹就在那里。不过它看起来像......
As you can see there are 2 folder src and build but no knockout.js, infact the whole directory doesnt contain a knockout.js file.
你可以看到有2个文件夹src和build但没有knockout.js,实际上整个目录都不包含knockout.js文件。
So im wondering whats the issue here? did something change and made the tutorial not valid? Am I doing somethiong stupid here?
所以我想知道这里的问题是什么?做了什么改变,使教程无效?我在这里做些傻事吗?
EDIT: I have a feeling this is the source and needs building not sure though
编辑:我有一种感觉,这是源头和需求建设不确定
EDIT2: Heres the Gruntfile.js located in proj source used in conjuntion with the trask runner as per the tutoriual i was following.
EDIT2:根据我正在关注的tutoriual,继承位于proj源中的Gruntfile.js与trask runner结合使用。
module.exports = function (grunt) {
grunt.initConfig({
bower: {
install: {
options: {
targetDir: "wwwroot/lib",
layout: "byComponent",
cleanTargetDir: false
}
}
}
});
grunt.registerTask("default", ["bower:install"]);
grunt.loadNpmTasks("grunt-bower-task");
};
I think my gruntfile is missing some key stuff here, just not sure what (not well versed in grunt im afraid)
我想我的gruntfile在这里缺少一些关键的东西,只是不确定是什么(我不擅长咕噜咕噜)
1 个解决方案
#1
0
Bower pulls the whole package and puts it into "bower_packages/package_name" folder. You can force bower to change default destination directory (in your case it is "wwwroot/lib" folder) but it still gets whole package.
Bower拉出整个包并将其放入“bower_packages / package_name”文件夹。您可以强制bower更改默认目标目录(在您的情况下它是“wwwroot / lib”文件夹)但它仍然获得整个包。
In order to put in the "wwwroot/lib" folder only package build results (files mentioned in the package's bower.json main" property) I'm using "bower-installer" tool. It calls bower to get packages and then gets "main" files for each package and put them in destination folder.
为了在“wwwroot / lib”文件夹中只放入包构建结果(包中的bower.json main“属性中提到的文件)我正在使用”bower-installer“工具。它调用bower来获取包然后得到”主要的“每个包的文件,并将它们放在目标文件夹中。
Update 1
bower.json
{
"name": "_______",
"version": "0.0.0",
"dependencies": {
"jquery": "~2.1.0",
"jqueryui": "~1.11.4",
"knockout": "^3.4.0"
},
"install": {
"path": "wwwroot/lib",
"sources": {
"knockout": {
"mapping": [
{
"bower_components/knockout/dist/knockout.debug.js": "knockout.js"
}
]
}
}
}
}
Presumable bower and bower-installer packages are installed globally. Just create bower.json file in any empty folder and run "bower-installer" command from command line in this folder. You should get "bower_components" folder with full package and "\wwwroot\lib\knockout\knockout.js" file. I've just checked it.
全球安装了Presumable bower和bower-installer软件包。只需在任何空文件夹中创建bower.json文件,然后从该文件夹中的命令行运行“bower-installer”命令。您应该获得包含完整包的“bower_components”文件夹和“\ wwwroot \ lib \ knockout \ knockout.js”文件。我刚检查过它。
#1
0
Bower pulls the whole package and puts it into "bower_packages/package_name" folder. You can force bower to change default destination directory (in your case it is "wwwroot/lib" folder) but it still gets whole package.
Bower拉出整个包并将其放入“bower_packages / package_name”文件夹。您可以强制bower更改默认目标目录(在您的情况下它是“wwwroot / lib”文件夹)但它仍然获得整个包。
In order to put in the "wwwroot/lib" folder only package build results (files mentioned in the package's bower.json main" property) I'm using "bower-installer" tool. It calls bower to get packages and then gets "main" files for each package and put them in destination folder.
为了在“wwwroot / lib”文件夹中只放入包构建结果(包中的bower.json main“属性中提到的文件)我正在使用”bower-installer“工具。它调用bower来获取包然后得到”主要的“每个包的文件,并将它们放在目标文件夹中。
Update 1
bower.json
{
"name": "_______",
"version": "0.0.0",
"dependencies": {
"jquery": "~2.1.0",
"jqueryui": "~1.11.4",
"knockout": "^3.4.0"
},
"install": {
"path": "wwwroot/lib",
"sources": {
"knockout": {
"mapping": [
{
"bower_components/knockout/dist/knockout.debug.js": "knockout.js"
}
]
}
}
}
}
Presumable bower and bower-installer packages are installed globally. Just create bower.json file in any empty folder and run "bower-installer" command from command line in this folder. You should get "bower_components" folder with full package and "\wwwroot\lib\knockout\knockout.js" file. I've just checked it.
全球安装了Presumable bower和bower-installer软件包。只需在任何空文件夹中创建bower.json文件,然后从该文件夹中的命令行运行“bower-installer”命令。您应该获得包含完整包的“bower_components”文件夹和“\ wwwroot \ lib \ knockout \ knockout.js”文件。我刚检查过它。