Reputation: 5042
I modified a culture setting file from Kendo (kendo.culture.en-US-Custom.min.js) and was able to minify it. But I don't know how to go about creating a .map against it. My network log shows a 404 against that file. Is there a generator for map file? Here is the file:
!function (e) { "function" == typeof define && define.amd ? define(["kendo.core.min"], e) : e() }(function () {
!function (e, y) {
kendo.cultures["en-US"] = {
name: "en-US", numberFormat: {
pattern: ["-n"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
percent: {
pattern: ["-n %", "n %"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
symbol: "%"
},
currency: {
name: "UAE Dirham",
abbr: "AED",
pattern: ["-n $", "n $"],
decimals: 2,
",": ",",
".": ".",
groupSize: [3],
symbol: "د.إ."
}
},
calendars: {
standard: {
days: {
names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
namesAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
namesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
},
months: {
names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
namesAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
},
AM: ["AM", "am", "AM"],
PM: ["PM", "pm", "PM"],
patterns: {
d: "dd-MMM-yyyy",
D: "dddd, MMMM dd, yyyy",
F: "dddd, MMMM dd, yyyy h:mm:ss tt",
g: "dd-MMM-yyyy h:mm tt",
G: "dd-MMM-yyyy h:mm:ss tt",
m: "MMMM d",
M: "MMMM d",
s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
t: "h:mm tt",
T: "h:mm:ss tt",
u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
y: "MMMM, yyyy", Y: "MMMM, yyyy"
},
"/": "/",
":": ":",
firstDay: 0
}
}
}
}(this)
});
Thanks.
Upvotes: 3
Views: 7133
Reputation: 3556
For creating the minimized version of your javascript source code you can follow one of this options.
Command line uglifi-js:
For installing:
npm install uglify-js -g
Running the command create the minimized file and the map:
uglifyjs kendo.culture.en-US-Custom.js
--source-map kendo.culture.en-US-Custom.min.js.map
-o kendo.culture.en-US-Custom.min.js
Follow the instruction of this link
Grunt Uglify:
You can use Grunt.js uglify:
To install:
npm install grunt-contrib-uglify --save-dev
The code in Gruntfile.js:
grunt.initConfig({
uglify: {
my_target: {
options: {
sourceMap: true // this line is for create the map
},
files: {
'kendo.culture.en-US-Custom.min.js': ['kendo.culture.en-US-Custom.js']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
Running the "uglify task" will create a minimized version of the file and the map.
Follow the instruction of this link
Gulp Uglify:
Alternatively you can do something similar with "Gulp Uglify".
Follow the instruction of this link
Upvotes: 5