Javascript 将引导切换添加到JHipster(角度2+;)
我想添加一个引导加载项,即JHipster项目。该项目由Javascript 将引导切换添加到JHipster(角度2+;),javascript,twitter-bootstrap,webpack,jhipster,Javascript,Twitter Bootstrap,Webpack,Jhipster,我想添加一个引导加载项,即JHipster项目。该项目由.css和.js文件组成,需要jquery 只需将其添加到index.html即可,但感觉有点黑客味。 如何将引导切换(或类似库)从我的node\u modules文件夹添加到应用程序?在angular 2+中,如果使用@angular/cli创建项目,则有.angular cli.json文件 在json文件中,在apps中,您可以添加要从node\u modules文件夹加载的style和scripts 例如,在我要添加的项目中,我添
.css
和.js
文件组成,需要jquery
只需将其添加到index.html
即可,但感觉有点黑客味。
如何将引导切换(或类似库)从我的
node\u modules
文件夹添加到应用程序?在angular 2+中,如果使用@angular/cli
创建项目,则有.angular cli.json
文件
在json文件中,在apps
中,您可以添加要从node\u modules
文件夹加载的style
和scripts
例如,在我要添加的项目中,我添加了font awesome.scss
,bootstrap.scss
和类似于jquery-tether和bootstrap
的脚本
"apps": [
{
"styles": [
"../node_modules/font-awesome/scss/font-awesome.scss",
"../node_modules/bootstrap/scss/bootstrap.scss",
"styles.scss"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],
],
它实际上比这两种建议都简单得多。您只需在
vendor.ts
中提及所需的资源即可。这包括javascript。
vendor.css
与vendor.scss
类似,但导入路径略有不同。据我所知,Tilde表示节点\u模块
文件夹
@import "~github-markdown-css/github-markdown.css";
仅此而已。不要干涉
.angular cli.json
或任何需要的内容。@RahulSingh我想你链接到了错误的问题。我很抱歉,这可能是重复的。这个问题的答案解释了如何使用第三方css或JS。使用Angular CLI可能是一个选项,但是JHipster项目不包含默认的.Angular CLI.json
。我宁愿不这样做,而使用模板已经提供的内容。
"apps": [
{
"styles": [
"../node_modules/font-awesome/scss/font-awesome.scss",
"../node_modules/bootstrap/scss/bootstrap.scss",
"styles.scss"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/tether/dist/js/tether.js",
"../node_modules/bootstrap/dist/js/bootstrap.js"
],
],
import '../content/scss/vendor.scss';
import '../content/css/vendor.css';
import 'path to js'
@import "~github-markdown-css/github-markdown.css";