我在为我的应用程序创建一个包并将文件放在包中时遇到了一些困难.
例如,Facebook已经使用他们的框架为iPhone应用程序开发了一个包.同样,我还想创建一个可以在许多应用程序中重用的包.
我的问题是:
目前我正在使用Jetty和Equinox开发基于OSGi的WebApp(参见:http://wiki.eclipse.org/Jetty/Tutorial/EclipseRT-Jetty-Starter-Kit).到目前为止一切都很好,但我无法访问我自己的一些文件/资源.位置/路径是"configuration/data/config.csv"和"configuration/data/data.zip".我测试了一切:
context.getBundleContext().getBundle().getEntry("config.csv");
context.getBundleContext().getBundle().getResource("config.csv");
this.getClass().getClassLoader().getResource("config.csv");
context.getBundleContext().getDataFile("config.csv");
Run Code Online (Sandbox Code Playgroud)
当然所有可能的路径变体如:"configuration/data/config.csv","/ configuration/data/config.csv","\ configuration/data/config.csv","/ config.csv".此外,我已将文件夹添加到OSGi类路径(在MANIFEST.MF中):
Bundle-ClassPath: .,
configuration/data/
Run Code Online (Sandbox Code Playgroud)
生成的URL看起来总是像这样(或null):"configuration/CBR-Data/config.csv",当我将它传输到File对象"D:\ configuration\CBR-Data\config.csv"时.
但我真正不明白的是我的一个DS的属性文件被完美加载:
<properties entry="configuration/dsconfig.properties"/>
有人有想法/提示或其他什么?我开车疯了......
我的包位于,src/Cinergy/Bundle/ComponentBundle/CinergyComponentBundle.php并且包的逻辑名称是'CinergyComponentBundle'.
由于我没有坚持公司的命名惯例,我必须更改捆绑的逻辑名称.让我知道我必须重命名它'XXXCinergyComponentBundle'
我需要更改哪些文件?
我尝试将CinergyComponentBundle.php文件和包含的类重命名为XXXCinergyComponentBundle.php.我还在AppKernel中更改了引用.
不幸的是,这不起作用.当我尝试清除缓存时,我收到以下错误消息:
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "cinergy.people.direct.php" has a dependency on a non-existent service "cinergy.work.registry".
Run Code Online (Sandbox Code Playgroud)
这两个服务确实属于具有新名称的包.这使我得出结论,我在重命名过程中遗漏了一些东西.
有任何想法吗?
ASP.NET MVC 4带来了将多个样式表或javascripts捆绑成如下所示的惊人工具:
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.theme.css"));
Run Code Online (Sandbox Code Playgroud)
NODE.JS是否有任何模块可以完成相同的任务 - 将客户端 javascript库捆绑成一个?我见过像browserify,uglifier等工具,但是这些需要手动调用控制台命令(或者我可能错过了什么?).同时,例如,消除这个过多的步骤并将中间件轻松集成到express.js应用程序中会很不错.
我正在尝试设置gitlab,从而使用sudo从另一个用户帐户安装一些宝石,但我经常遇到Permission denied错误.
sudo -u gitlab -H bundle install --deployment --without development test postgres
> Using ... ( a lot of successful gems there )
> Using pygments.rb (0.3.2) from https://github.com/gitlabhq/pygments.rb.git (at master)
> Errno::EACCES: Permission denied - pygments.rb-0.3.2.gem
> An error occurred while installing pygments.rb (0.3.2), and Bundler cannot continue.
> Make sure that `gem install pygments.rb -v '0.3.2'` succeeds before bundling.\
sudo -u gitlab -H gem install pygments.rb -v '0.3.2'
> Successfully installed pygments.rb-0.3.2
> 1 gem …Run Code Online (Sandbox Code Playgroud) 我的所有javascript和css结合在一起.但是,当我看到他们没有缩小.我不知道为什么.
我的包如下所示:
bundles.Add(new Bundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery-ui.js",
"~/Scripts/jquery.validate.js",
"~/Scripts/grid.locale-tr.js",
"~/Scripts/jquery.jqGrid.js",
"~/Scripts/bootstrap.js",
"~/Scripts/messages_tr.js",
"~/Scripts/jquery.form.js"
)
);
bundles.Add(new Bundle("~/bundles/mainjs").Include(
"~/Scripts/jquery-1.10.2.js",
"~/Scripts/bootstrap.js",
"~/Scripts/superfish.js",
"~/Scripts/jquery.flexslider.js",
"~/Scripts/jquery.kwicks-1.5.1.js",
"~/Scripts/jquery.easing.1.3.js",
"~/Scripts/jquery.cookie.js",
"~/Scripts/touchTouch.jquery.js"
)
);
bundles.Add(new Bundle("~/bundles/allcss").Include(
"~/Content/Css/bootstrap*",
"~/Content/Css/opa-icons.css",
"~/Content/Css/charisma-app.css",
"~/Content/Css/ui.jqgrid.css",
"~/Content/Css/jquery-ui.css"
)
);
bundles.Add(new Bundle("~/bundles/maincss").Include(
"~/Content/Css/bootstrap.css",
"~/Content/Css/responsive.css",
"~/Content/Css/style.css",
"~/Content/Css/touchTouch.css",
"~/Content/Css/kwicks-slider.css"
)
);
Run Code Online (Sandbox Code Playgroud)
我的全球性asax如下所示:
protected void Application_Start()
{
#if DEBUG
BundleTable.EnableOptimizations = false;
#else
BundleTable.EnableOptimizations = true;
#endif
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
GlobalConfiguration.Configuration.MessageHandlers.Add(new CorsHandler());
}
Run Code Online (Sandbox Code Playgroud)
和:
@System.Web.Optimization.Scripts.Render("~/bundles/mainjs")
@System.Web.Optimization.Styles.Render("~/bundles/maincss")
Run Code Online (Sandbox Code Playgroud) 我需要知道指定"BundleTable.EnableOptimizations = true;"是否会自动缩小文件(js和Css),或者只选择.min(如果可用)?
我正在构建一个应用程序,可以根据需要加载各种模块(由不同的webpack配置生成的其他包).该BaseModule负责,知道什么时候加载的包和出口一些默认的类一样BaseUtils.模块本身不知道可能需要加载的所有可能的模块/包.
TestModule是运行时按需加载BaseModule并TestModule希望使用的模块之一BaseUtils.
现在的问题是:是否有可能require('basemodule/BaseUtils')在TestModule,它有自己的webpack.config.js文件中,BaseModule列出外部?也就是说,有没有办法让生成的testmodule bundle重用生成的basemodule bundle中可用的模块?或者BaseModule是否需要导出到全局变量?
当我gem install bundler在MacOS 10.13.x中使用命令时,错误是You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
$ gem install bundler
Fetching: bundler-1.16.2.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
Run Code Online (Sandbox Code Playgroud) 我设置了 webpack 分析器来查看我的包大小,我注意到 React-dom 被包含了两次。有谁知道这是为什么以及如何解决它?

这也是我的 package.json:
{
"name": "test",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"analyze": "cross-env ANALYZE=true next build"
},
"dependencies": {
"framer-motion": "^10.12.16",
"next": "^13.4.6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@next/bundle-analyzer": "^13.4.6",
"autoprefixer": "^10.4.14",
"cross-env": "^7.0.3",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2"
}
}
Run Code Online (Sandbox Code Playgroud)