我是Rails的新手,目前正在通过指南.该指南指出:
使用文本编辑器使用清单2.1的内容更新Bundler所需的Gemfile.
Run Code Online (Sandbox Code Playgroud)source 'https://rubygems.org' gem 'rails', '3.2.3' group :development do gem 'sqlite3', '1.3.5' end # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '3.2.4' gem 'coffee-rails', '3.2.2' gem 'uglifier', '1.2.3' end gem 'jquery-rails', '2.0.0' group :production do gem 'pg', '0.12.2' end然后,我们使用以下
bundle install命令安装并包含gem :Run Code Online (Sandbox Code Playgroud)$ bundle install --without production如果Bundler抱怨
no such file to load -- readline (LoadError)尝试添加gem ’rb-readline’到您的Gemfile.)
我按照步骤甚至添加gem 'rb-readline'到了Gemfile …
我正在尝试MVC4 System.Web.Optimization 1.0 ScriptBundle功能.
我有以下配置:
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
// shared scripts
Bundle canvasScripts =
new ScriptBundle(BundlePaths.CanvasScripts)
.Include("~/Scripts/modernizr-*")
.Include("~/Scripts/json2.js")
.Include("~/Scripts/columnizer.js")
.Include("~/Scripts/jquery.ui.message.min.js")
.Include("~/Scripts/Shared/achievements.js")
.Include("~/Scripts/Shared/canvas.js");
bundles.Add(canvasScripts);
}
}
Run Code Online (Sandbox Code Playgroud)
以及以下观点:
<script type="text/javascript" src="@Scripts.Url(BundlePaths.CanvasScripts)"></script>
Run Code Online (Sandbox Code Playgroud)
哪里BundlePaths.CanvasScripts是"~/bundles/scripts/canvas".它呈现:
<script type="text/javascript" src="/bundles/scripts/canvas?v=UTH3XqH0UXWjJzi-gtX03eU183BJNpFNg8anioG14_41"></script>
Run Code Online (Sandbox Code Playgroud)
到目前为止一切都很好,除了~/Scripts/Shared/achievements.js是捆绑源中的第一个脚本.这取决于它之前包含的每个脚本ScriptBundle.我如何确保它遵守我向包中添加include语句的顺序?
更新
这是一个相对较新的ASP.NET MVC 4应用程序,但它引用了优化框架预发布包.我删除了它并从http://nuget.org/packages/Microsoft.AspNet.Web.Optimization添加了RTM包.使用web.config中带有debug = true的RTM版本,@Scripts.Render("~/bundles/scripts/canvas")以正确的顺序呈现各个脚本标记.
在web.config中使用debug = false,组合脚本首先使用achievement.js脚本,但由于它是稍后调用的函数定义(对象构造函数),因此它运行时没有错误.也许minifier足够聪明,可以找出依赖关系?
我还尝试了IBundleOrdererDarin Dimitrov在RTM中使用两种调试选项建议的实现,并且它的行为相同.
所以缩小版本不是我期望的顺序,但它的工作原理.
在android.os.Message使用Bundle发送与它的sendMessage法.因此,有可能把HashMap一个Bundle?
我得到了通用的要点,即CommonsChunkPlugin查看所有入口点,检查它们之间是否存在共同的包/依赖关系,并将它们分成自己的包.
所以,我们假设我有以下配置:
...
enrty : {
entry1 : 'entry1.js', //which has 'jquery' as a dependency
entry2 : 'entry2.js', //which has 'jquery as a dependency
vendors : [
'jquery',
'some_jquery_plugin' //which has 'jquery' as a dependency
]
},
output: {
path: PATHS.build,
filename: '[name].bundle.js'
}
...
Run Code Online (Sandbox Code Playgroud)
CommonsChunkPlugin我最终会得到3个新的捆绑文件:
entry1.bundle.js它包含来自entry1.js和的完整代码,jquery并包含自己的运行时entry2.bundle.js它包含来自entry2.js和的完整代码,jquery并包含自己的运行时vendors.bundle.js它包含来自jquery和的完整代码,some_jquery_plugin并包含自己的运行时这显然很糟糕,因为我可能会jquery在页面中加载3次,所以我们不希望这样.
CommonsChunkPlugin根据我传递给CommonsChunkPlugin任何以下任何参数的参数将发生:
情况1:如果我通过,{ name …
我们正在考虑创建我们自己common的实体映射和服务包,以便在几个单独的应用程序中使用.捆绑包应该易于修改,运行,包含和测试.我知道构建捆绑包的最佳实践,但我不知道git在开发时使用什么策略.
我们应该创建commonbundle作为一个整体项目并将整个存储库提交给我们的git服务器,还是最好只为commonbundle的root启动源代码控制并仅推送其内容?我在捆绑包中看到了这种方法github,但我不知道以这种方式开发捆绑包的简单方便.
我有一个应用程序我想提交给Apple.我已经验证了它.我正在使用Xcode 7和Swift 2.当我尝试提交给Apple时,我收到以下错误:
ERROR ITMS-90474:"捆绑无效.iPad多任务支持需要有方向:'UIInterfaceOrientationPortrait,UIIinterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'.在捆绑中找到'UIInterfaceOrientationPortrait'.
我该怎么办?我用他们要求的名字制作一些图像吗?
在我的android应用程序中,我总是使用类的直接putExtra()函数Intent将任意数量的值传递给new Activity.
像这样:
Intent i = new Intent(this, MyActivity.class);
i.putExtra(ID_EXTRA1, "1");
i.putExtra(ID_EXTRA2, "111");
startActivity(i);
Run Code Online (Sandbox Code Playgroud)
我Bundle在Android中知道,我看到人们正在使用Bundle将值传递给新的Activity.
像这样:
Intent intent = new Intent(this, MyActivity.class);
Bundle extras = new Bundle();
extras.putString("EXTRA_USERNAME","my_username");
extras.putString("EXTRA_PASSWORD","my_password");
intent.putExtras(extras);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
在这里,我有两个疑问.如果我可以直接将值传递给new ,我
为什么要使用?
使用而不是直接使用有什么好处?BundleActivityIntentBundleIntent putExtra()
我正在尝试使用ASP.NET MVC 4应用程序进行ASP.NET Bundling.情况是我想制作一个CDN样式的服务,它有JS和CSS文件,您可以从其他类型地址的网站处理:http://www.mycdn.com/scripts/plugin/js,捆绑并缩小所有包含的.js文件.
我对一个文件的bundle配置如下所示:
bundles.Add(new ScriptBundle("~/Scripts/plugin/pluginjs").Include("~/Scripts/plugin/jquery.plugin.js"));
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做时,即使我更改原始js文件后,捆绑包也不会更新.当我刷新浏览器时,我继续获得304 Not Modified,并且不会更新缩小文件的内容.如何更新捆绑包,因为捆绑旧内容是没用的?我尝试了各种方法,但无法找到解决方案.
提前致谢!
asp.net bundle bundling-and-minification asp.net-optimization
我在活动A中有一个整数数组:
int array[] = {1,2,3};
Run Code Online (Sandbox Code Playgroud)
我想将该变量发送到活动B,因此我创建了一个新的intent并使用了putExtra方法:
Intent i = new Intent(A.this, B.class);
i.putExtra("numbers", array);
startActivity(i);
Run Code Online (Sandbox Code Playgroud)
在活动BI中获取信息:
Bundle extras = getIntent().getExtras();
int arrayB = extras.getInt("numbers");
Run Code Online (Sandbox Code Playgroud)
但这并不是真的发送数组,我只是在arrayB上得到值'0'.我一直在寻找一些例子,但我没有发现任何事情.
我正在运行bundle install,我收到此错误:
Building nokogiri using system libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --use-system-libraries
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
--use-system-libraries …Run Code Online (Sandbox Code Playgroud)