gruntjs

How to grunt-uglify multiple script files while keeping folder structure

心不动则不痛 提交于 2019-12-03 18:28:19
问题 I have not found a good way to grunt-uglify multiple script files spread over multiple folders while keeping the folder structure including the uglified files intact. The only reason I want to do this is to be able to increase the performance of the "legacy" part of the web page I'm working on. I have found a way around this which I don't want to do, since it will take to much time, and that is to do it like in this answer (they specify each src and dest pair seperately): how to config grunt

Dynamically add version number to dest output files w/ grunt

*爱你&永不变心* 提交于 2019-12-03 18:22:20
问题 I have a package.json file with our version number, such as: { name: "myproject" version: "2.0" } My goal is to dynamically add the version number from the package.json file into the output files. For example, in the javascript I don't want to manually update the version number, but would like something similar to this to be generated after each grunt build: /* My Project, v2.0 */ window.myProject = { version: "2.0" }; Is there an easy way to do this in my Gruntfile.js configuration? 回答1: I

Grunt fails to run on Azure Web Site

只愿长相守 提交于 2019-12-03 17:57:49
问题 I'm trying to build and package my project using Azure's Git deployment. I have created the following files .deployment deploy.cmd Gruntfile.js package.json My .deployment file calls deploy.cmd . deploy.cmd sets up the environment by setting the path to include a checked in copy of Node.js and npm. I can call npm install just fine. When I call grunt , it seems to execute up to the first standard out message, then it returns and the error return code is set. I don't get any other message than

How to define individual flows in useminPrepare for each block in html file?

末鹿安然 提交于 2019-12-03 17:31:30
问题 We have 2 blocks defined in our index.html - one for 3rd party libs and one for our application files. Since 3rd party libs are already minified, we just want to concatenate them, but not uglify. How can I do this with useminPrepare ? <!-- build:js js/lib.js --> <script src="lib/angular/angular.min.js"></script> <script src="lib/angular-cookies/angular-cookies.min.js"></script> <script src="lib/angular-route/angular-route.min.js"></script> <!-- endbuild --> <!-- build:js js/app.js --> <script

gruntjs: use files with dynamic mapping in multitask config once for all targets

▼魔方 西西 提交于 2019-12-03 17:17:41
in my multi task I want to use dynamic mappings for files config property files: [ { expand: true, // Enable dynamic expansion. cwd: 'lib/', // Src matches are relative to this path. src: ['**/*.js'], // Actual pattern(s) to match. dest: 'build/', // Destination path prefix. }, ] is it possible to specify the "files" property once for all targets (and they would be expanded) to avoid redundancy? all targets are working with the same file structure, with the same files something like: taskName: { target1: { prop1:1 }, target2: { prop1:2 }, files: [ { expand: true, // Enable dynamic expansion.

cssmin not correctly handling @import

牧云@^-^@ 提交于 2019-12-03 17:13:10
问题 I am using cssmin on files containing @imports. cssmin is recursively importing local files correctly, but for imports that point to a URL the imports are left inline. This makes the resulting minified CSS invalid because @ rules must be at the beginning of the file. Does anyone know a good solution or workaround to this problem? 回答1: I have exactly the same problem with cssmin and @import , and i found a solution with grunt concat : Create a concat grunt task that: Put @import url in the

Inline require() working in requirejs but not with optimized almond build

孤者浪人 提交于 2019-12-03 17:03:09
问题 As the title says my inline require calls are working in a non-optimized requirejs run but not working when built with grunt and almondjs. Uncaught Error: undefined missing views/some/view The top of any file might be: define( ['jquery', 'app'], function($, App) { and later on based on business logic I want to be able to require another file require(['views/some/view'], function(SomeView){ console.log(SomeView); }); I tried the alternative syntax as well: var SomeView= require('views/some

Integrating the MobileServiceClient with AngularJS

妖精的绣舞 提交于 2019-12-03 16:53:11
I'm trying to use the WindowsAzure.MobileServiceClient within Angular to do single sign on and CRUD operations. Being an Angular noob, I'm trying to figure out the best way to do this: Instantiate it in the $rootScope in .run and call the functions from there? Create a service or factory and make the instantiation of the MobileServiceClient and all of the function calls in that? Would the currentUser and other information get lost when the service/factory isn't being used? Just spool up MobileServiceClient in the controllers that need it? Seems to me if I do it that way, currentUser info would

How do we set a target in a grunt cssmin task?

丶灬走出姿态 提交于 2019-12-03 16:28:23
I am trying out cssmin for Grunt According to the docs targets can be defined "according to the grunt Configuring tasks guide." When I create a cssmin task using that pattern, like: cssmin: { my_target: { minify: { src: 'path-to/default.css', dest: 'path-to/default.min.css' } } } the minified file is not created. If I remove the target level it works as expected. Do I do something wrong here? or are there other options than cssmin (In my research I picked this as everybody was pointing to it) Using: grunt v0.4.1 cssmin v0.6.0 Your configuration is just a little off. minify is also just a

Why does Yeoman build without glyphicons?

北战南征 提交于 2019-12-03 16:05:49
I'm working on a webapp generator and after running grunt I got a functional app which display fonts correctly. However, when I check in the dist/ directory I don't get any fonts files. The docs state that grunt command build the application for deployment , but the dist/ directory isn't autonomous. Gruntfile.js config My copy:dist task is as follow: dist: { files: [{ expand: true, dot: true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>', src: [ '*.{ico,png,txt}', '.htaccess', 'images/{,*/}*.{webp,gif}', 'styles/fonts/{,*/}*.*' ] }] }, So it does copy font, but not the glyphicons one