草庐IT

grunt-contrib-copy

全部标签

javascript - 将杏仁与 grunt-contrib-requirejs 一起使用

我正在尝试设置一个使用requirejs和almond的gruntfile。docs建议这应该很容易,并且在他们的带领下,我尝试了:requirejs:{compile:{options:{baseUrl:"tmp",mainConfigFile:"tmp/main.js",name:"../bower_components/almond/almond",out:"tmp/.js"}}}不幸的是,这种方法编译的是almond.js而不是我的实际源代码。我弄错了什么吗?我如何将杏仁与requirejs一起自动化? 最佳答案 诀窍是使用

javascript - 在 Bootstrap 模式中调用时,工作 "Copy to Clipboard"函数不起作用

目标:将Bootstrap模式中的文本复制到剪贴板。JS:$(document).ready(function(){$(document).on('click','#copy-btn',function(){//varvalue=$('#error-message').html();//usingastaticvalue,justtoeliminateanyquestion//aboutwhatshouldbecopied.copytext('kilroytestedthis');})});functioncopytext(text){vartextField=document.cre

javascript - 如何使用 grunt 缩小 JSON 文本文件?

我需要使用Grunt/grunt-contrib-uglify压缩一组JSON文件(语言文件):grunt.initConfig({pkg:grunt.file.readJSON('package.json'),uglify:{build:{src:'src/main/app/resources/locales/*/*.json',dest:'target/resources/locales/*/*.json'}}});我得到的是:Files:src/main/app/resources/locales/en/messages.json->target/*/*.jsonMinifyin

当我使用 document.execCommand ("copy"时,javascript 换行符不适用)

你好我正在使用下面的代码构建一个字符串并复制它,但是当我粘贴它时在输出中换行符不适用functioncopyToClipboardShipto(){var$temp=$("");$("body").append($temp);varstr1="@(Model.firstName)";varstr2="";varstr3="@(Model.lastName)";varstr4="\n";varstr5="@(Model.shiptoes[0].address.address1)";varstr6=",";varstr7="@(Model.shiptoes[0].address.addre

javascript - Grunt Watch 反复显示 "Warning: must provide pattern"

我在配置Grunt以查看我的项目文件、重建和更新连接服务器中托管的页面时遇到问题。如果我运行任何构建任务,然后将'watch'作为组合任务的一部分,那么'watch'似乎陷入循环,无休止地打印消息.Running"watch"taskWaiting...Warning:mustprovidepattern如果我只是运行$gruntwatch,它会很高兴地观察我的源文件并根据需要进行编译/构建。我认为相关的任务配置是这些:watch:{html:{files:['','',''],tasks:['html']},sass:{files:['sass/*.scss'],tasks:['st

javascript - 在 Grunt 中使用全局变量设置构建输出路径

我有几个繁重的任务,我试图在这些任务之间共享全局变量,但我遇到了问题。我已经编写了一些自定义任务,这些任务根据构建类型设置正确的输出路径。这似乎设置正确。//SetMode(localorbuild)grunt.registerTask("setBuildType","Setthebuildtype.Eitherbuildorlocal",function(val){//grunt.log.writeln(val+":setBuildTypeval");global.buildType=val;});//SetOutputlocationgrunt.registerTask("setO

javascript - Grunt 任务陷入无限循环

正在为一些即将开展的项目构建基础Gruntfile.js。从一台新电脑开始,一切都是全新的。使用Homebrew安装了Node和NPM,然后在全局以及我的本地目录中安装了Grunt。这是我的package.json:{"name":"timespent-prototype","version":"0.1.0","devDependencies":{"assemble":"0.4.37","bower":"^1.4.1","grunt":"^0.4.5","grunt-contrib-concat":"^0.5.1","grunt-contrib-sass":"^0.9.2","grun

javascript - 如何让 'grunt less' 自动运行 autoprefixer?

我有一个带有less和autoprefixer的工作Gruntfile。我也有'gruntwatch'工作正常。在我使用autoprefixer之前,我使用较少的mixin作为vendor前缀。运行'gruntless'将构建带有我所有前缀的工作CSS。现在我有了autoprefixer,但如果我想一次性构建我的样式,我现在必须先运行“gruntless”然后运行“gruntautoprefixer”才能使用带前缀的CSS。我如何修改'gruntless'使其能够正常工作,再次减少前缀?I'vereadthedocs,andIknowIcouldaddanadditionaltaskt

javascript - document.execCommand ('copy' ) 在 Chrome 上不工作

仅在Chrome上document.execCommand('copy')返回true但不复制文本,它清除剪贴板。我找不到遇到同样问题的人,有很多类似的问题,但请不要将其标记为重复,除非它确实是重复的。我在selection.addRange()之前调用selection.removeAllRanges()。selection.getRangeAt(0).cloneContents()返回包含正确文本的片段文本区域中的文本未显示为选中如果我在document.execCommand('copy')之前调用textarea.select(),文本将显示为选中状态并复制到剪贴板。我不想这样

javascript - 简单网站的 Grunt + require.js 配置

我的网站有以下简单结构:srcjscore.jsmain.jslibjquery-1.8.2.jsrequire-2.1.1.jsrequire-text.jstemplates1.html2.htmlindex.htmlbuild我希望将所有js+lib文件编译成一个build/js/main.js文件,而其他文件只复制到build文件夹中。如何为此任务编写grunt.js配置?看来我应该使用grunt-contrib-require..第二个问题是如何将1.html和2.html(我使用requiretext!插件)编译成一行并将这些行包含到build/js/main.js中?在这