Comments (6)
It works on my end--what OS?
from grunt-contrib-compress.
Mac OS X Mountain Lion
from grunt-contrib-compress.
Huh. Can you post your grunt config, or a link to the project if it is public?
from grunt-contrib-compress.
"use strict";
/*jshint globalstrict: true*/
/*global console: true, module: true, require: true*/
module.exports = function(grunt) {
var _ = require('underscore');
var sharedPath = function( options ) {
options.angularUI = options.angularUI || false;
options.jqueryUI = options.jqueryUI || false;
var vendorSRC = ['*.js'];
if(!options.angularUI) {vendorSRC.push('!ui-*.js');}
if(!options.jqueryUI) {vendorSRC.push('!jquery.*.js');}
if(!options.momentJS) {vendorSRC.push('!moment*.js');}
var styleSRC = ['base.css'];
if(options.jqSlider) {styleSRC.push('jqslider.min.css');}
var appSRC = ['**/*'];
if(options.exclude) {appSRC.push(options.exclude);}
return([
{
expand: true,
cwd: '<%= dirs.dev.'+ options.name +' %>/',
src: appSRC,
dest: '<%= dirs.prod.'+ options.name +' %>/',
filter: 'isFile'
},
{
expand: true,
cwd: '<%= dirs.temp.css %>/',
src: styleSRC,
dest: '<%= dirs.prod.'+ options.name +' %>/css/'
},
{
expand: true,
cwd: '<%= dirs.temp.img %>/',
src: ['*'],
dest: '<%= dirs.prod.'+ options.name +' %>/img/'
},
{
expand: true,
cwd: '<%= dirs.temp.lib %>/',
src: ['*.js'],
dest: '<%= dirs.prod.'+ options.name +' %>/js/lib/'
},
{
expand: true,
cwd: '<%= dirs.temp.vendor %>/',
src: vendorSRC,
dest: '<%= dirs.prod.'+ options.name +' %>/js/vendor/'
}
]);
};
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
dirs: {
dev: {
Credit: 'Credit/app',
IBAN: 'IBAN/app',
Invest: 'Invest/app',
Leasing: 'Leasing/app',
Pension: 'Pension/app',
Tax: 'Tax/app',
css: 'css',
img: 'img',
less: 'less',
lib: 'lib',
vendor: 'vendor'
},
prod: {
build: 'target/build',
src: 'target/src',
Credit: '<%= dirs.prod.src %>/Credit',
IBAN: '<%= dirs.prod.src %>/IBAN',
Leasing: '<%= dirs.prod.src %>/Leasing',
Pension: '<%= dirs.prod.src %>/Pension',
Tax: '<%= dirs.prod.src %>/Tax'
},
temp: {
// Deleted after copy task and preprocessing
css: 'target/css',
img: 'target/img',
lib: 'target/lib',
vendor: 'target/vendor'
}
},
copy: {
vendor: {
files: [
{'<%= dirs.temp.vendor %>/angular.min.js': '<%= dirs.dev.vendor %>/angularjs/angular.min.js'},
{'<%= dirs.temp.vendor %>/underscore-min.js': '<%= dirs.dev.vendor %>/underscorejs/underscore-min.js'},
{'<%= dirs.temp.vendor %>/ui-bootstrap-tpls-0.1.0.min.js': '<%= dirs.dev.vendor %>/angularui-bootstrap/ui-bootstrap-tpls-0.1.0.min.js'},
{'<%= dirs.temp.vendor %>/jquery.min.js': '<%= dirs.dev.vendor %>/jquery/jquery.min.js'},
{'<%= dirs.temp.vendor %>/jquery.ui.core.min.js': '<%= dirs.dev.vendor %>/jquery-ui/jquery.ui.core.min.js'},
{'<%= dirs.temp.vendor %>/jquery.ui.widget.min.js': '<%= dirs.dev.vendor %>/jquery-ui/jquery.ui.widget.min.js'},
{'<%= dirs.temp.vendor %>/jquery.ui.mouse.min.js': '<%= dirs.dev.vendor %>/jquery-ui/jquery.ui.mouse.min.js'},
{'<%= dirs.temp.vendor %>/jquery.ui.slider.min.js': '<%= dirs.dev.vendor %>/jquery-ui/jquery.ui.slider.min.js'},
{'<%= dirs.temp.vendor %>/moment.min.js': '<%= dirs.dev.vendor %>/moment/moment.min.js'},
{'<%= dirs.temp.vendor %>/moment-range.js': '<%= dirs.dev.vendor %>/moment-range/moment-range.js'}
]
},
lib: {
files: [
{expand: true, cwd: '<%= dirs.dev.lib %>/', src: '*.js', dest: '<%= dirs.temp.lib %>'}
]
},
css: {
files: [
{'<%= dirs.temp.css %>/jqslider.modified.css': '<%= dirs.dev.css %>/jqslider.modified.css'},
{'<%= dirs.temp.css %>/jqslider.css': '<%= dirs.dev.css %>/jqslider.css'}
]
},
img: {
files: [
{expand: true, cwd: '<%= dirs.dev.img %>/', src: '*', dest: '<%= dirs.temp.img %>'}
]
},
IBAN: {
files: sharedPath({name: 'IBAN'})
},
Leasing: {
files: sharedPath({name: 'Leasing'})
},
Credit: {
files: sharedPath({
name: 'Credit',
angularUI: true,
jqueryUI: true,
jqSlider: true
})
},
Tax: {
files: sharedPath({
name: 'Tax',
angularUI: true
})
},
Pension: {
files: sharedPath({
name: 'Pension',
momentJS: true,
exclude: '!js/ThirdPillar.js'
})
}
},
compress: {
all: {
options: {
archive: '<%= dirs.prod.build %>/Calculators_<%= grunt.template.today("yyyymmdd_HHMM") %>.zip'
},
files: [
{expand: true, cwd: '<%= dirs.prod.src %>', src:['**']}
]
}
},
connect: {
server: {
options: {
keepalive: true,
port: 8000
}
}
},
cssmin: {
jqslider: {
options: {
keepSpecialComments: 0
},
files: {
'<%= dirs.temp.css %>/jqslider.min.css': ['<%= dirs.temp.css %>/jqslider.css']
}
},
main: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
keepSpecialComments: 0
},
files: {
'<%= dirs.temp.css %>/base.css': ['<%= dirs.temp.css %>/base.css']
}
}
},
clean: {
temp: [
'<%= dirs.temp.css %>',
'<%= dirs.temp.lib %>',
'<%= dirs.temp.vendor %>',
'<%= dirs.temp.img %>'
],
src: [
'<%= dirs.prod.src %>'
],
build: [
'<%= dirs.prod.build %>'
]
},
jshint: {
all: [
'Gruntfile.js',
'lib/**/**.js',
'<%= dirs.dev.Credit %>/**/**.js',
'<%= dirs.dev.Leasing %>/**/**.js',
'<%= dirs.dev.IBAN %>/**/**.js',
'<%= dirs.dev.Tax %>/**/**.js',
'<%= dirs.dev.Pension %>/**/**.js'
]
},
karma: {
unit: {
configFile: 'config/karma.conf.js',
singleRun: true
},
e2e: {
configFile: 'config/karma-e2e.conf.js'
}
},
less: {
production: {
options: {
paths: ["<%= dirs.dev.vendor %>/"],
yuicompress: false
},
files: {
"<%= dirs.temp.css %>/base.css": "<%= dirs.dev.less %>/base.less"
}
}
},
preprocess: {
options: {
context: {
DEBUG: true,
vendorURLS:
'<link rel="stylesheet" href="../css/base.css" />\n'+
'\t<script src="../js/vendor/underscore-min.js"></script>\n'+
'\t<script src="../js/vendor/angular.min.js"></script>\n'+
'\t<script src="../js/lib/seb.js"></script>\n'+
'\t<script src="../js/lib/localize.js"></script>\n'+
'\t<script src="../js/lib/admin.js"></script>\n',
angularUI:
'<script src="../js/vendor/ui-bootstrap-tpls-0.1.0.min.js"></script>',
jqueryUI:
'<link rel="stylesheet" href="../css/jqslider.min.css" />\n'+
'<script src="../js/vendor/jquery.min.js"></script>\n'+
'\t<script src="../js/vendor/jquery.ui.core.min.js"></script>\n'+
'\t<script src="../js/vendor/jquery.ui.widget.min.js"></script>\n'+
'\t<script src="../js/vendor/jquery.ui.mouse.min.js"></script>\n'+
'\t<script src="../js/vendor/jquery.ui.slider.min.js"></script>\n',
momentJS:
'\t<script src="../js/vendor/moment.min.js"></script>\n'+
'\t<script src="../js/vendor/moment-range.js"></script>'
}
},
IBAN: {
src: '<%= dirs.prod.IBAN %>/html/iban.html',
dest: '<%= dirs.prod.IBAN %>/html/iban.html'
},
Leasing: {
src: '<%= dirs.prod.Leasing %>/html/lease.html',
dest: '<%= dirs.prod.Leasing %>/html/lease.html'
},
Credit: {
files: {
'<%= dirs.prod.Credit %>/html/mortgage.html': '<%= dirs.prod.Credit %>/html/mortgage.html',
'<%= dirs.prod.Credit %>/html/consumer.html': '<%= dirs.prod.Credit %>/html/consumer.html'
}
},
Tax: {
src: '<%= dirs.prod.Tax %>/html/tax.html',
dest: '<%= dirs.prod.Tax %>/html/tax.html'
},
Pension: {
src: '<%= dirs.prod.Pension %>/html/pension.html',
dest: '<%= dirs.prod.Pension %>/html/pension.html'
}
},
shell: {
diffJqSlider: {
command:'diff -Naur jqslider.css jqslider.modified.css >> target.patch',
options: {
stdout: true,
execOptions: {
cwd: '<%= dirs.temp.css %>/'
}
}
},
patchJqSlider: {
command:'patch -u jqslider.css target.patch; rm target.patch; rm jqslider.modified.css',
options: {
stdout: true,
execOptions: {
cwd: '<%= dirs.temp.css %>/'
}
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
mangle: false
},
IBAN: {
files: {
'<%= dirs.prod.IBAN %>/js/iban.js': ['<%= dirs.prod.IBAN %>/js/iban.js']
}
},
Leasing: {
files: {
'<%= dirs.prod.Leasing %>/js/leasing.js': ['<%= dirs.prod.Leasing %>/js/leasing.js']
}
},
Credit: {
files: {
'<%= dirs.prod.Credit %>/js/credit.js': ['<%= dirs.prod.Credit %>/js/credit.js']
}
},
Tax: {
files: {
'<%= dirs.prod.Tax %>/js/tax.js': ['<%= dirs.prod.Tax %>/js/tax.js']
}
},
Pension: {
files: {
'<%= dirs.prod.Pension %>/js/tax.js': ['<%= dirs.prod.Pension %>/js/pension.js']
}
}
}
});
// Load Tasks
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-preprocess');
grunt.loadNpmTasks('grunt-shell');
// Task aliases
grunt.registerTask('clean:all', ['clean:temp', 'clean:src']);
grunt.registerTask('copy:res', ['copy:css', 'copy:img', 'copy:lib', 'copy:vendor']);
grunt.registerTask('copy:calculators', ['copy:IBAN', 'copy:Leasing', 'copy:Credit', 'copy:Tax', 'copy:Pension']);
grunt.registerTask('patch:jqSlider', ['shell:diffJqSlider', 'shell:patchJqSlider']);
grunt.registerTask('preprocess:all', ['preprocess']);
grunt.registerTask('test', ['karma:unit','karma:e2e', 'jshint']);
grunt.registerTask('test:e2e', ['karma:e2e']);
grunt.registerTask('test:unit', ['karma:unit']);
grunt.registerTask('uglify:all', ['uglify']);
grunt.registerTask('build', 'Builds project for deployment', function( name ) {
var tasks = [
'clean:all',
'test',
'copy:res',
'less',
'patch:jqSlider',
'cssmin',
'copy:calculators',
'preprocess',
'uglify',
'compress',
'clean:temp'
];
grunt.task.run(tasks);
});
// Default task
grunt.registerTask('default', []);
};
from grunt-contrib-compress.
Kinda strange thing, not sure if some kind of magic happened or what, but I had some need to rename some json files I had to js, and grunt-contrib-compress task started working properly..
from grunt-contrib-compress.
yay, computers!
from grunt-contrib-compress.
Related Issues (20)
- optional brotli dependency breaks windows installs HOT 5
- How to compress symlink?
- Release 1.4.3 breaking builds HOT 2
- Archiver 2.0.0 HOT 1
- Fatal error: Cannot read property 'pipesCount' of undefined HOT 4
- Sometimes Generates Duplicate Files in Same Folder HOT 2
- Fatal error when compressing files larger than 2GB
- Rename function is ignored HOT 1
- Better compression ratios HOT 1
- Fatal error: path must be a string or Buffer
- Feature request: Zip file output mime type
- Tar file corrupted when attempting to create <pkg.name>.tar HOT 1
- [Security] Vulnerability in `tar` HOT 4
- Possible to exclude archives that would be empty?
- Update iltorb to fix tar vulnerability and compatibility with Node 12 HOT 2
- Lodash prototype pollution vulnerability
- Update iltorb to 2.4.4 to support Node 13
- Exclude folder does not work
- Security vuln with [email protected]
- Upgrade to Node 14 is breaking grunt compress output
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-contrib-compress.