问题标签 [webjars]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1578 浏览

runtime - 如何配置嵌入式码头+ webjars

我有一个运行嵌入式码头服务器的项目。另外,我在项目的依赖项中有 angularjs-1.2.12.jar。

如何配置码头,以公开 META-INF/资源中的文件。我尝试执行以下操作:

但只有来自目标/类的文件被公开。

谢谢你。

UPD:已解决

0 投票
1 回答
1861 浏览

requirejs - 如何使用 webjars!加载器插件?

在我之前的 Play 应用程序中,我曾经使用 Webjars 和 RequireJS 来管理依赖项。我可以毫无问题地使用 require(['angular', 'webjars!ui-bootstrap-tpls.js'], function(angular) {...}) 。

最近我在 www.webjars.org 上更新了 webjars 和几个 webjars 相关的 deps(webjars-ui-bootstrap 等)到最新版本,我找到了 webjars!加载程序插件无法正常工作。我检查了 webjars-seed-play 应用程序并修改了一些代码,例如:

它只是抱怨 ui.bootstrap 不可用,我认为应该由 webjars!ui-bootstrap-tpls.js 加载。我在这里做错了什么?请帮我。谢谢。

我在 build.sbt 中的部门:

0 投票
1 回答
751 浏览

twitter-bootstrap - 在 Play 2.x 中覆盖 WebJar 资源

只是想知道,是否有一种方法可以覆盖WebJars资产中的某些资产,确切地说是 JS 和 LESS 文件,这些资产位于app/assets/目录中。

比如说,我安装了一个bootstrap 3.1.1 webjar,那么我该如何使用我自己的variables.less文件呢?假设简单地把它放在stylesheets文件夹中是行不通的。

对于 LESS,也许可以从我的资产中导入它们,但其他的呢?

0 投票
1 回答
653 浏览

spring-mvc - WebJars doesn't work with Tomcat7 + SpringMVC + Sitemesh3

I'm trying to make my application works with WebJars running on Tomcat7 but the CSS/JS files aren't found by my HTML pages.

I already change the web.xml to v3.0 and the facets of the project too (inside Eclipse). Also checked the web.xml from tge container and that's already configured as v3.0 too.

As I'm using SpringMVC, I made the configuration described into the official documentation:

Inside my "sitemesh3.xml" file, I already configured an exclusion to the folder "resources":

Inside my "decotator.html" file I'm trying to access the JS by this way:

or

Inside my "pom.xml" file correctly added the dependency:

To me it looks like the Tomcat7 is deploying the application as servlet version 2.5, once that the files inside the select2.jar aren't being public exposed.

Does someone know if I need to configure something more? Can you see anything wrong?

0 投票
2 回答
290 浏览

javascript - 是否可以使用 Dojo webjars SourceMaps 来使用未压缩文件?

最近我正在测试这个库:

https://github.com/webjars/dojo

这很棒,因为我可以将 dojo 作为 maven 库带到我的项目中。然而问题是,如果没有未压缩的文件,调试起来有点困难。我知道使用未压缩文件的一种方法是覆盖文件 dojo.js.uncompressed.js。为此,我复制 dojo.js.uncompressed.js 文件并将其粘贴到文件夹中:

webapp/webjars/dojo/1.9.2/dojo

与 dojo.js.uncompressed.js 同名,在第 1012 行我更改了:

经过:

虽然这解决了使用未压缩文件的问题,但它是一个丑陋的解决方案。我知道其他方式可以覆盖定义和需要函数,但这将更难以实现。

所以基本上我想知道是否有一种方法可以将源映射与 dojo webjars 一起使用,以避免以前的黑客攻击。

0 投票
1 回答
1100 浏览

sbt - 如何使用 sbt 构建自定义 Bootstrap WebJar?

我想构建一个 WebJar,其中包含来自 LESS 源的品牌定制版 Bootstrap。我有sbt.version=0.13.5-M4inproject/build.propertiesaddSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0-M2a")in project/plugins.sbt。我的build.sbt样子是这样的:

我得到的错误是:

我错过了什么?

0 投票
1 回答
1129 浏览

spring-mvc - jawr、webjars、bootstrap、spring mvc - 字形图标不显示

我正在使用 webjars 来提供引导 css。而且我还使用 webjar 包中的字形图标。

但不幸的是,未加载图标。

我注意到jarr 正在重写css url:

不幸的是,jarr 不提供 ttf 文件。

问题:

  • 如何使 Jawr 服务于 ttf 和其他非 css、js 图像文件?
  • 如何让 Jawr 通过那个“有趣”的 url 为这些资源提供服务?
  • 还有其他解决方案吗?
0 投票
1 回答
965 浏览

java - 使用 webjar 进行 r.js 缩小

我们的团队正在编写一个服务器-客户端应用程序,其中前端是一个使用 Spring MVC java 后端的 Angular.js 单页应用程序。后端为浏览器端使用的应用程序文件和 REST 端点提供服务。我们使用 Maven 作为应用程序的主要构建系统。

我们喜欢在最后利用 require.js 和 r.js 来缩小应用程序,我们也使用客户端依赖管理。目前我们正在使用 bower 下载所需的 Javascript 库,但我觉得将客户端依赖项下载到 src/main/webapp 并不合适,因为这是一个源文件夹。但是,为了避免每次客户端文件发生更改时都重新构建整个前端模块,这对我们来说似乎是唯一明智的方法。这样我们就可以启动一个 Web 服务器,它会自动获取更改而无需重新启动,但正如我所说,这不适合 Maven 的文件夹布局。

我正在尝试使用 Webjar,这在我们面向 Maven 的构建和依赖管理中似乎是一个更好的选择。因为在 Servlet 3.0 容器中,webjar 资源是在服务器容器路径上自动提供的,因此非常易于使用和管理它们。也可以创建一个 require.js 配置来引用 webjar 中包含的库,因为它们在 web 服务器路径上的方式与静态文件相同,从客户端应用程序的角度来看,服务是透明地完成的。

我唯一的问题是我不知道如何使用这种布局实现 r.js 缩小,因为源文件位于 jar 文件中,r.js 无法访问它们。此外,require.js 配置指的是构建时根本不存在的运行时服务器路径。

我看到webjars 现在与 Require.js + Play Framework 有一些集成,但在我们的案例中,我们并没有使用 Play,只是简单的 Spring MVC。我真的希望有办法处理这种情况,因为我喜欢 Webjar 客户端依赖处理的方式。

0 投票
1 回答
375 浏览

angularjs - webjar requirejs angular ie8 foreach loop

I cannot make requirejs work with angularjs project and webjars in ie8, ( I dont have error in firefox, chrome).

With ie debug bar I have this error :

In this code :

this code is generate with requirejs/webjars

forEach loop is compatible with IE 8 ?

how can i fix this problem ?

0 投票
1 回答
231 浏览

playframework-2.0 - 玩!带有 *.html 文件的 Framework 2.X WebJar:从控制器访问

我们正在尝试为我们的 Play 创建一个插件模型!项目。该插件应包含 Java/Scala 代码和 html 模板文件(带有 css、js)。

WebJars 的示例描述了如何引用静态资产,如 css 和 js,但我们找不到如何包含和利用(来自 Controller)html 模板文件。