gruntjs

Working project structure that uses grunt.js to combine JavaScript files using RequireJS?

为君一笑 提交于 2019-12-04 07:39:20
问题 I have some projects that use RequireJS to load individual JavaScript modules in the browser, but I haven't optimized them yet. In both development and production, the app makes a separate request for each JavaScript file, and now I would like to fix that using Grunt. I have tried to put together a simple project structure to no avail, so I'm wondering if someone can provide a working example for me. My goals are the following: In development mode, everything works in the browser by issuing a

Removing file extension using grunt-contrib-connect and grunt-connect-rewrite

蓝咒 提交于 2019-12-04 06:51:36
I'm trying to remove '.html' from files in my grunt web app. http://testing.com/one/ should return index.html from that folder, but if there is no trailing slash ( http://testing.com/one ) it should check for one.html The grunt-connect-rewrite seems to be working fine with examples that I can find, but removing file extensions from .html files seems to be killing me. The rule here is one similar to what i'd use in an .htaccess file. connect: { server: { options: { port: 9000, keepalive: true, base: 'dist', middleware: function(connect, options) { return [ rewriteRulesSnippet, // Serve static

Splashscreen wrong since XCode 7

回眸只為那壹抹淺笑 提交于 2019-12-04 06:30:00
问题 I took over a project using AngularJS, Ionic and Bootstrap to create hybrid apps for mobile devices. Prior to upgrade to XCode 7 all went well. I updated my HTML-, CSS- and JS-code in editor, ran grunt run:ios to create platform code and opened XCode. From there I built the .ipa-file without any issues (justwith some warnings, which could be ignored). However since using XCode 7 (needed for iOS 8- and iOS 9-devices), the splascreen will be shown incorrectly. Meaning: Rotated with 90°. Note #1

Grunt Watch repeatedly showing “Warning: must provide pattern”

我怕爱的太早我们不能终老 提交于 2019-12-04 06:20:06
I'm having trouble configuring Grunt to watch my project files, rebuild and update a page hosted in a connect server. If I run any of the build tasks and then 'watch' as part of a combined task, then 'watch' seems to get stuck in a loop, endlessly printing the message. Running "watch" task Waiting... Warning: must provide pattern If instead I just run $ grunt watch , it will happily watch my source files and compile/build as appropriate. I think the relevant task configurations are these: watch: { html: { files: [ '<%= site.partials %>', '<%= site.layouts %>', '<%= site.pages %>' ], tasks: [

yeoman webapp with grunt-connect-proxy not working

我只是一个虾纸丫 提交于 2019-12-04 05:31:40
I have installed the yeoman webapp generator and I am trying to set up a proxy to another server. I installed the proxy with the following. npm install grunt-connect-proxy --save-dev When I run grunt server, it shows Running "configureProxies" task Proxy created for: /people to localhost:3000 It then directs me to a page running on localhost:9000 which says "Cannot GET /" There is a server running at localhost:3000 and I have tried other domains with no succes. Here is my Gruntfile.js // Generated on 2013-10-01 using generator-webapp 0.4.2 'use strict'; var proxySnippet = require('grunt

Grunt: custom task development how-to

♀尐吖头ヾ 提交于 2019-12-04 04:57:30
I need to implement a custom Grunt task and I'm absolutely lost about the development workflow. How do I develop a custom task and I simulate loading it using npm during development? Is there any other way of distributing custom tasks instead of using npm ? I mean, can I distribute a JavaScript file defining the whole custom Grunt task and import it in the Gruntfile.js directly? Since the whole task would be in a very early development stage, maybe the effort of publishing it in npm isn't a good idea. Thanks in advance. custom grunt tasks are basically node-modules which you can publish to the

grunt serve from a fresh Yeoman install returns - Warning: Task “serve” not found

孤街醉人 提交于 2019-12-04 04:44:13
After running yo angular and then cd 'ing into the application's root folder (at same level as the app folder, gruntfile , package.json etc) I try grunt serve and I get the above error. Grunt won't start a server for me. I have searched all over but couldn't find say to run npm install and bower install within the application's root directory, which I have tried but still the same error. I've updated and checked bower/grunt/npm and they're all good. Any suggestions please? bitfidget I think I have found a solution! http://yang-wei.github.io/blog/2014/06/01/npm-install-issues-plus-angularjs-set

How to replace in stream using Gulp?

拥有回忆 提交于 2019-12-04 04:29:21
I try to switch from Grunt to Gulp and I have an issue: I read two streams from two files var fileStream = gulp.src(file); var injectionStream = gulp.src(injection) .pipe(replace('#class-name#', argv.cname)); If my console argument "--remove" is absent I have no problem to concatenate these streams .pipe(concat('animation.styl')) .pipe(gulp.dest('./dist')) However when '--remove' is true I want to delete injection, in other words, subtract injectionStream from fileStream. I tried: var es = require('event-stream'); es.replace() var replace = require('gulp-replace'); It works with strings, but I

Combine and minify all bower libraries with gruntjs

痞子三分冷 提交于 2019-12-04 04:27:18
Is there a way to combine and minify all bower installed libraries into 1 file automatically? First I tried the most basic approach: combine all .js files from all subdirectories: uglify: { options: {compress: true}, my_target: { files: { 'vendor.js': ['bower_components/**/*.js'], } } } But this is obviously a bad approach. It also doesn't work because of too many errors. I manually deleted all the files and kept only 1 (main) file that each library has, and it worked. Is there a way to do this all automatically? Also, is it advisable to do it? (i.e. combine all vendor libraries into 1 file) I