简体   繁体   English

如何在Electron Project中全局使用CSS和JS npm模块?

[英]How to use CSS and JS npm modules globally in Electron Project?

I have an Electron project I'm working on, but I'm facing an inconvenience when attempting to use jQuery and Materialize-css globally. 我有一个正在进行的Electron项目,但是尝试在全球范围内使用jQueryMaterialize-css时遇到不便。 Is there a way to include/import/require them (they are already installed via npm install --save and are present in node_modules directory), so the will be valid in every new child window the application opens? 有没有办法包含/导入/获取它们(它们已经通过npm install --save ,并存在于node_modules目录中),因此在应用程序打开的每个新子窗口中都有效吗? Currently I'm using the HTML way ( <link rel... for the css styles and <script src... for the JavaScript files) but as my project has lots of child windows, which load different html files, I would like to use those modules globally. 目前,我正在使用HTML方式(对于CSS样式,使用<link rel... ,对于JavaScript文件,使用<script src... ),但是由于我的项目有很多子窗口,这些子窗口会加载不同的html文件,所以我想在全球范围内使用这些模块。

我用:

npm install "framework" -g

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM