草庐IT

grunt-contrib-copy

全部标签

ruby - 如何验证 IO.copy_stream 是否成功

这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下

ruby-on-rails - Grunt task Compass 失败——找不到 RubyGem compass (>= 0)

我最近将机器从iMac转移到带有Mavericks的新MacBookPro。一切都很好,但我注意到当我保存文件时Grunt崩溃了(自动更新不工作)。我试图更新我的系统,但是当我通过终端运行我的grunt任务时,我收到以下错误:Running"compass:dev"(compass)task/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in`report_activate_error':CouldnotfindRubyGemcompass(>=0)(Gem:

ruby - 如何在 ruby​​ on rails 中显示 Datatable tabletools (copy, csv, excel, pdf, save)

我在我的ruby​​onrails应用程序中使用数据表。我按照这里的同一个..https://github.com/rweng/jquery-datatables-rails我的数据表排序和搜索工作正常。但是我在表格标题中看不到我的表格工具选项(例如-复制、csv、excel、pdf、保存)。我想像这样显示我的表....请帮忙。 最佳答案 我通过添加ZeroClipboard.js得到了这个 关于ruby-如何在ruby​​onrails中显示Datatabletabletools(co

ruby - 无法使用 Bootstrap 4 Alpha 2 在 grunt dist 上加载 grunt/sauce_browsers.yml

我正在尝试编译自定义版本的bootstrapv4alpha2,但我不断收到2个错误。请帮忙。我对ruby一窍不通。我成功安装了$geminstallbundler其实bootstrap下是没有.bundle目录的从/node_modules/bootstrap运行以下命令失败$bundleinstall以下也失败了:$gruntdistLoading"Gruntfile.js"tasks...ERROR>>Error:Unabletoread"grunt/sauce_browsers.yml"file(Errorcode:ENOENT).Warning:Task"dist"notfou

ruby-on-rails - rails : Copying attributes from an object to another using the "attributes" method

让模型Quote具有属性[price,description]让模型Invoice有属性[price,description,priority]让invoice模型Invoice中的对象具有属性{price:10,description:'lamp',priority:10}invoice={price:10,description:'lamp',priority:10}假设我想将invoice属性复制到新的quote。quote=Quote.new(invoice.attributes)这会引发一个错误,即priority在模型Quote中不存在。如何将invoice属性复制到新的q

javascript - grunt-typescript 不会在指定的 `dest` 中生成 js 文件

我有以下目录结构:root||_package.json|_Gruntfile.js||_javascripts/|_ts/file.ts在Gruntfile中我有这个://ProjectConfiggrunt.initConfig({pkg:grunt.file.readJSON('package.json'),typescript:{base:{src:['./javascripts/ts/*.ts'],dest:'./javascripts/'}}});我希望js文件位于javascripts/目录中。但是,当我运行grunttypescript时,它会创建这个奇怪的目录结构:r

javascript - 如何在 Grunt 中使用 stylelint?

我正在尝试替换grunt-scss-lint(因为它的Ruby依赖性和未安装gem时的静默失败)与stylelint.我遇到的问题是以下错误:$gruntLoading"Gruntfile.js"tasks...ERROR>>ReferenceError:Mapisnotdefined我认为这是因为stylelint(它是一个PostCSS插件,而不是一个Grunt插件)需要ES6。Here'sthecodethat'sthrowingtheMapisnotdefinederror.有什么方法可以让它工作,我可以只运行grunt而不是一些奇怪的解决方法likethis?

javascript - Chrome Selection.addRange() 不选择(一个 execCommand ('copy' )用例)

在Chrome中编写一个小型浏览器扩展程序,以将一些特定文本从特定网页复制到剪贴板。以HTML格式,以便人们可以将其粘贴到word、outlook等办公程序中。document.execCommand('copy')是我使用的命令,它由document.onkeydown组合键(Alt+1)触发,它工作正常-但只是第一次。如果您尝试再次按下组合键,它将不会执行任何操作。我找到了原因,document.queryCommandEnabled("copy")第一次返回true,任何其他尝试返回false。如果我重新加载页面,它会第一次再次返回true。此外,如果我在加载页面后在浏览器窗口外

javascript - grunt.task.run() 不工作

我正在尝试在我的express应用程序中使用grunt。我有这样的东西:vargrunt=require('grunt');require(process.cwd()+'/gruntfile.js')(grunt);grunt.task.run('development');但是这个任务好像不行。(没有错误输出到控制台)但是,如果我直接在控制台“gruntdevelopment”中运行,它就可以正常工作。 最佳答案 grunt.task.run只是将一个任务添加到队列中,因此它可以在现有任务中运行,但不能在外部脚本中运行。这是我从g

javascript - Grunt imagemin - 观看多个文件/文件夹优化单个文件?

是否可以使用grunt-contrib-imagemine和grunt-contrib-watch查看多个文件/文件夹但只优化单个文件?我这样试过:(gruntfile的一部分)imagemin:{dist:{cwd:'images/modules',files:['images/modules/**/*.{png,jpg,gif}'],dest:'images/modules'}},watch:{images:{files:['images/modules/**/*.{png,jpg,gif}'],tasks:['imagemin'],options:{spawn:false,}}}