-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INTERNAL] Use clean-css for compression instead of less.js with compress #360
base: v2
Are you sure you want to change the base?
Changes from all commits
3aa1678
ce1236d
fc93f44
403c0a8
664640b
9e0a24e
1ca6d4c
aec319d
75c54b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const CleanCSS = require("clean-css"); | ||
const log = require("@ui5/logger").getLogger("builder:processors:cssOptimizer"); | ||
|
||
/** | ||
* Optimizes the supplied CSS resources. | ||
* | ||
* @public | ||
* @alias module:@ui5/builder.processors.cssOptimizer | ||
* @param {Object} parameters Parameters | ||
* @param {module:@ui5/fs.Resource[]} parameters.resources List of resources to be processed | ||
* @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with optimized resources | ||
*/ | ||
module.exports = function({resources}) { | ||
// use clean-css default options | ||
const options = { | ||
returnPromise: true | ||
}; | ||
const cleanCSSInstance = new CleanCSS(options); | ||
return Promise.all(resources.map((resource) => { | ||
return resource.getString().then((css) => { | ||
return cleanCSSInstance.minify(css).then((result) => { | ||
if (Array.isArray(result.warnings) && result.warnings.length) { | ||
log.warn(`Warnings occurred: ${result.warnings.join(", ")}`); | ||
} | ||
resource.setString(result.styles); | ||
return resource; | ||
}, (error) => { | ||
throw new Error(`Errors occurred: ${error.join(", ")}`); | ||
}); | ||
}); | ||
})); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* function */ | ||
._sapUiTableVScrWithActionsInnerMixin_CalcMarginRight(@ScrollbarSize, @RowActionWidth) { | ||
margin-right: calc(@ScrollbarSize ~"+" @RowActionWidth); | ||
} | ||
|
||
._sapUiTableVScrWithActionsInnerMixin(@ScrollbarSize, @RowActionWidth) { | ||
|
||
.meinnerle { | ||
._sapUiTableVScrWithActionsInnerMixin_CalcMarginRight(@ScrollbarSize, @RowActionWidth); | ||
} | ||
|
||
.myele { | ||
margin-right: @ScrollbarSize; | ||
} | ||
} | ||
|
||
.supi:not(.thehe) { | ||
._sapUiTableVScrWithActionsInnerMixin(0px, @_mywidth); | ||
} | ||
|
||
.button { | ||
color: @_mycolor1; | ||
background-color: @_mycolor2; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"_mywidth":"0.25rem","_mycolor1":"#ff00ff","_mycolor2":"#ff00ff"} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@_mywidth: 0.25rem; | ||
@_mycolor1: #ff00ff; | ||
@_mycolor2: #f0f; | ||
@import "Button.less"; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"someColor":"#000"} | ||
{"someColor":"#000000"} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* function */ | ||
._sapUiTableVScrWithActionsInnerMixin_CalcMarginRight(@ScrollbarSize, @RowActionWidth) { | ||
margin-right: calc(@ScrollbarSize ~"+" @RowActionWidth); | ||
} | ||
|
||
._sapUiTableVScrWithActionsInnerMixin(@ScrollbarSize, @RowActionWidth) { | ||
|
||
.meinnerle { | ||
._sapUiTableVScrWithActionsInnerMixin_CalcMarginRight(@ScrollbarSize, @RowActionWidth); | ||
} | ||
|
||
.myele { | ||
margin-right: @ScrollbarSize; | ||
} | ||
} | ||
|
||
.supi:not(.thehe) { | ||
._sapUiTableVScrWithActionsInnerMixin(0px, @_mywidth); | ||
} | ||
|
||
.button { | ||
color: @_mycolor1; | ||
background-color: @_mycolor2; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@_mywidth: 0.25rem; | ||
@_mycolor1: #ff00ff; | ||
@_mycolor2: #f0f; | ||
@import "Button.less"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A warning log in the code would also be reasonable. Similar to https://github.com/SAP/ui5-fs/blob/master/lib/resourceFactory.js#L72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with 75c54b9