mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #11897 from meteor/always-minify-css-resource
Pass lazy css resources to minifier in development
This commit is contained in:
@@ -1120,8 +1120,7 @@ class Target {
|
||||
// Takes a CssOutputResource and returns a string of minified CSS,
|
||||
// or null to indicate no minification occurred.
|
||||
minifyCssResource: (resource) => {
|
||||
if (! minifiersByExt.css ||
|
||||
minifyMode === "development") {
|
||||
if (! minifiersByExt.css) {
|
||||
// Indicates the caller should use the original resource.data
|
||||
// without minification.
|
||||
return null;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<body>
|
||||
<div class="production_css">Text for prod</div>
|
||||
<div class="development_css">Text for devel</div>
|
||||
<div class="minified_lazy">Text for imported</div>
|
||||
</body>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
if (Meteor.isClient) {
|
||||
require('./imports/imported.css');
|
||||
|
||||
Meteor.startup(function () {
|
||||
['production_css', 'development_css'].forEach(cls => {
|
||||
['production_css', 'development_css', 'minified_lazy'].forEach(cls => {
|
||||
var color = getComputedStyle(document.querySelectorAll('.' + cls)[0]).color;
|
||||
Meteor.call('print', cls + ': ' + color);
|
||||
});
|
||||
|
||||
3
tools/tests/apps/custom-minifier/imports/imported.css
Normal file
3
tools/tests/apps/custom-minifier/imports/imported.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.lazy-resource {
|
||||
color: rgb(0, 256, 0);
|
||||
}
|
||||
@@ -29,6 +29,7 @@ CustomMinifier.prototype.processFilesForBundle = function (files, options) {
|
||||
data: contents
|
||||
});
|
||||
} else {
|
||||
contents = contents.replace(/lazy-resource/g, 'minified_lazy');
|
||||
file.addStylesheet({
|
||||
data: contents
|
||||
});
|
||||
@@ -37,5 +38,3 @@ CustomMinifier.prototype.processFilesForBundle = function (files, options) {
|
||||
Plugin.nudge();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ selftest.define('custom minifier - devel vs prod', function (options) {
|
||||
|
||||
run.match('production_css: rgb(255, 0, 0)');
|
||||
run.match('development_css: rgb(0, 0, 0)');
|
||||
run.match('minified_lazy: rgb(0, 255, 0)');
|
||||
run.match('Message (client): production_js');
|
||||
|
||||
run.stop();
|
||||
@@ -43,6 +44,7 @@ selftest.define('custom minifier - devel vs prod', function (options) {
|
||||
|
||||
run.match('production_css: rgb(0, 0, 0)');
|
||||
run.match('development_css: rgb(255, 0, 0)');
|
||||
run.match('minified_lazy: rgb(0, 255, 0)');
|
||||
run.match('Message (client): development_js');
|
||||
|
||||
run.stop();
|
||||
|
||||
Reference in New Issue
Block a user