mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Give minifiers an option to set the output path for files
Also makes linked js urls better in devel mode
This commit is contained in:
@@ -15,7 +15,8 @@ CssToolsMinifier.prototype.processFilesForTarget = function (files, mode) {
|
||||
if (mode === 'development') {
|
||||
files[0].addStylesheet({
|
||||
data: merged.code,
|
||||
sourceMap: merged.sourceMap
|
||||
sourceMap: merged.sourceMap,
|
||||
path: 'merged-stylesheets.css'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ UglifyJSMinifier.prototype.processFilesForTarget = function (files, mode) {
|
||||
files.forEach(function (file) {
|
||||
file.addJavaScript({
|
||||
data: file.getContentsAsBuffer(),
|
||||
sourceMap: file.getSourceMap()
|
||||
sourceMap: file.getSourceMap(),
|
||||
path: file.getPathInPackage()
|
||||
});
|
||||
});
|
||||
return;
|
||||
|
||||
@@ -846,7 +846,13 @@ _.extend(Target.prototype, {
|
||||
if (file.sourceMap) {
|
||||
newFile.setSourceMap(file.sourceMap, '/');
|
||||
}
|
||||
newFile.setUrlToHash('.js');
|
||||
|
||||
if (file.path) {
|
||||
newFile.setUrlFromRelPath(file.path);
|
||||
newFile.targetPath = file.path;
|
||||
} else {
|
||||
newFile.setUrlToHash('.js');
|
||||
}
|
||||
|
||||
return newFile;
|
||||
});
|
||||
@@ -998,7 +1004,13 @@ _.extend(ClientTarget.prototype, {
|
||||
if (file.sourceMap) {
|
||||
newFile.setSourceMap(file.sourceMap, '/');
|
||||
}
|
||||
newFile.setUrlToHash('.css', '?meteor_css_resource=true');
|
||||
|
||||
if (file.path) {
|
||||
newFile.setUrlFromRelPath(file.path);
|
||||
newFile.targetPath = file.path;
|
||||
} else {
|
||||
newFile.setUrlToHash('.css', '?meteor_css_resource=true');
|
||||
}
|
||||
|
||||
return newFile;
|
||||
});
|
||||
|
||||
@@ -51,12 +51,14 @@ util.inherits(JsFile, InputFile);
|
||||
_.extend(JsFile.prototype, {
|
||||
// - data
|
||||
// - sourceMap
|
||||
// - path
|
||||
// - hash?
|
||||
addJavaScript: function (options) {
|
||||
var self = this;
|
||||
self._minifiedFiles.push({
|
||||
data: options.data,
|
||||
sourceMap: options.sourceMap
|
||||
sourceMap: options.sourceMap,
|
||||
path: options.path
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -70,12 +72,14 @@ util.inherits(CssFile, InputFile);
|
||||
_.extend(CssFile.prototype, {
|
||||
// - data
|
||||
// - sourceMap
|
||||
// - path
|
||||
// - hash?
|
||||
addStylesheet: function (options) {
|
||||
var self = this;
|
||||
self._minifiedFiles.push({
|
||||
data: options.data,
|
||||
sourceMap: options.sourceMap
|
||||
sourceMap: options.sourceMap,
|
||||
path: options.path
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user