How do I minify CSS classnames with Ember CLI?
I looked through the docs on how to do this but nothing turned up.
There's this:
The compiled css-files are minified by broccoli-clean-css or
broccoli-csso, if it is installed locally
So I'm guessing it uses broccoli-clean-css
by default which uses clean-css
. I looked at both clean-css
and csso
and neither seem to have an option for mangling/minifying class names.
So I looked at how the React / Webpack folks are doing it. They seem to use css-loader which relies on post-css
.
As far as I can tell, Ember doesn't use PostCSS out of the box?
Question: how can I get Ember CLI to mangle class names and remove useless classes/IDs like .ember-view
and #ember123
?
My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.
Edit:
I'm using ember-component-css but it doesn't have support for controlling all class names in a module.
Looks like I'd have to migrate to ember-css-modules which has the generateScopedName
config option.
css ember.js ember-cli
add a comment |
I looked through the docs on how to do this but nothing turned up.
There's this:
The compiled css-files are minified by broccoli-clean-css or
broccoli-csso, if it is installed locally
So I'm guessing it uses broccoli-clean-css
by default which uses clean-css
. I looked at both clean-css
and csso
and neither seem to have an option for mangling/minifying class names.
So I looked at how the React / Webpack folks are doing it. They seem to use css-loader which relies on post-css
.
As far as I can tell, Ember doesn't use PostCSS out of the box?
Question: how can I get Ember CLI to mangle class names and remove useless classes/IDs like .ember-view
and #ember123
?
My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.
Edit:
I'm using ember-component-css but it doesn't have support for controlling all class names in a module.
Looks like I'd have to migrate to ember-css-modules which has the generateScopedName
config option.
css ember.js ember-cli
I wouldn't consider your example classes and IDs useless. They are added by the framework you are using for a reason.
– jelhan
Nov 10 '18 at 11:34
@jelhan what's the reason?
– Maros Hluska
Nov 10 '18 at 11:58
Could you please add your use case? I'm not quite sure if I understand why you want to remove these IDs and class names.
– jelhan
Nov 12 '18 at 8:20
@jelhan the use case is given in the question: "My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.". I do SSR with FastBoot. But an SSR request is slow (avg. 1 second) so I use Redis caching to speed it up. But I have lots of pages in Redis and I don't want to buy a larger Redis instance, thus I need smaller payloads in Redis. A couple techniques to achieve this: 1. mangle classes, 2. remove pointless classes
– Maros Hluska
Nov 13 '18 at 8:45
I don't think anyone has implemented this. Feel free to be the first.
– Gaurav
Nov 15 '18 at 18:47
add a comment |
I looked through the docs on how to do this but nothing turned up.
There's this:
The compiled css-files are minified by broccoli-clean-css or
broccoli-csso, if it is installed locally
So I'm guessing it uses broccoli-clean-css
by default which uses clean-css
. I looked at both clean-css
and csso
and neither seem to have an option for mangling/minifying class names.
So I looked at how the React / Webpack folks are doing it. They seem to use css-loader which relies on post-css
.
As far as I can tell, Ember doesn't use PostCSS out of the box?
Question: how can I get Ember CLI to mangle class names and remove useless classes/IDs like .ember-view
and #ember123
?
My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.
Edit:
I'm using ember-component-css but it doesn't have support for controlling all class names in a module.
Looks like I'd have to migrate to ember-css-modules which has the generateScopedName
config option.
css ember.js ember-cli
I looked through the docs on how to do this but nothing turned up.
There's this:
The compiled css-files are minified by broccoli-clean-css or
broccoli-csso, if it is installed locally
So I'm guessing it uses broccoli-clean-css
by default which uses clean-css
. I looked at both clean-css
and csso
and neither seem to have an option for mangling/minifying class names.
So I looked at how the React / Webpack folks are doing it. They seem to use css-loader which relies on post-css
.
As far as I can tell, Ember doesn't use PostCSS out of the box?
Question: how can I get Ember CLI to mangle class names and remove useless classes/IDs like .ember-view
and #ember123
?
My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.
Edit:
I'm using ember-component-css but it doesn't have support for controlling all class names in a module.
Looks like I'd have to migrate to ember-css-modules which has the generateScopedName
config option.
css ember.js ember-cli
css ember.js ember-cli
edited Nov 10 '18 at 7:25
asked Nov 10 '18 at 6:40
Maros Hluska
98811536
98811536
I wouldn't consider your example classes and IDs useless. They are added by the framework you are using for a reason.
– jelhan
Nov 10 '18 at 11:34
@jelhan what's the reason?
– Maros Hluska
Nov 10 '18 at 11:58
Could you please add your use case? I'm not quite sure if I understand why you want to remove these IDs and class names.
– jelhan
Nov 12 '18 at 8:20
@jelhan the use case is given in the question: "My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.". I do SSR with FastBoot. But an SSR request is slow (avg. 1 second) so I use Redis caching to speed it up. But I have lots of pages in Redis and I don't want to buy a larger Redis instance, thus I need smaller payloads in Redis. A couple techniques to achieve this: 1. mangle classes, 2. remove pointless classes
– Maros Hluska
Nov 13 '18 at 8:45
I don't think anyone has implemented this. Feel free to be the first.
– Gaurav
Nov 15 '18 at 18:47
add a comment |
I wouldn't consider your example classes and IDs useless. They are added by the framework you are using for a reason.
– jelhan
Nov 10 '18 at 11:34
@jelhan what's the reason?
– Maros Hluska
Nov 10 '18 at 11:58
Could you please add your use case? I'm not quite sure if I understand why you want to remove these IDs and class names.
– jelhan
Nov 12 '18 at 8:20
@jelhan the use case is given in the question: "My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.". I do SSR with FastBoot. But an SSR request is slow (avg. 1 second) so I use Redis caching to speed it up. But I have lots of pages in Redis and I don't want to buy a larger Redis instance, thus I need smaller payloads in Redis. A couple techniques to achieve this: 1. mangle classes, 2. remove pointless classes
– Maros Hluska
Nov 13 '18 at 8:45
I don't think anyone has implemented this. Feel free to be the first.
– Gaurav
Nov 15 '18 at 18:47
I wouldn't consider your example classes and IDs useless. They are added by the framework you are using for a reason.
– jelhan
Nov 10 '18 at 11:34
I wouldn't consider your example classes and IDs useless. They are added by the framework you are using for a reason.
– jelhan
Nov 10 '18 at 11:34
@jelhan what's the reason?
– Maros Hluska
Nov 10 '18 at 11:58
@jelhan what's the reason?
– Maros Hluska
Nov 10 '18 at 11:58
Could you please add your use case? I'm not quite sure if I understand why you want to remove these IDs and class names.
– jelhan
Nov 12 '18 at 8:20
Could you please add your use case? I'm not quite sure if I understand why you want to remove these IDs and class names.
– jelhan
Nov 12 '18 at 8:20
@jelhan the use case is given in the question: "My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.". I do SSR with FastBoot. But an SSR request is slow (avg. 1 second) so I use Redis caching to speed it up. But I have lots of pages in Redis and I don't want to buy a larger Redis instance, thus I need smaller payloads in Redis. A couple techniques to achieve this: 1. mangle classes, 2. remove pointless classes
– Maros Hluska
Nov 13 '18 at 8:45
@jelhan the use case is given in the question: "My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.". I do SSR with FastBoot. But an SSR request is slow (avg. 1 second) so I use Redis caching to speed it up. But I have lots of pages in Redis and I don't want to buy a larger Redis instance, thus I need smaller payloads in Redis. A couple techniques to achieve this: 1. mangle classes, 2. remove pointless classes
– Maros Hluska
Nov 13 '18 at 8:45
I don't think anyone has implemented this. Feel free to be the first.
– Gaurav
Nov 15 '18 at 18:47
I don't think anyone has implemented this. Feel free to be the first.
– Gaurav
Nov 15 '18 at 18:47
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236615%2fhow-do-i-minify-css-classnames-with-ember-cli%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236615%2fhow-do-i-minify-css-classnames-with-ember-cli%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I wouldn't consider your example classes and IDs useless. They are added by the framework you are using for a reason.
– jelhan
Nov 10 '18 at 11:34
@jelhan what's the reason?
– Maros Hluska
Nov 10 '18 at 11:58
Could you please add your use case? I'm not quite sure if I understand why you want to remove these IDs and class names.
– jelhan
Nov 12 '18 at 8:20
@jelhan the use case is given in the question: "My motivation for this is I want to cache SSR content in Redis but my Redis instance is filling up so I need smaller payloads.". I do SSR with FastBoot. But an SSR request is slow (avg. 1 second) so I use Redis caching to speed it up. But I have lots of pages in Redis and I don't want to buy a larger Redis instance, thus I need smaller payloads in Redis. A couple techniques to achieve this: 1. mangle classes, 2. remove pointless classes
– Maros Hluska
Nov 13 '18 at 8:45
I don't think anyone has implemented this. Feel free to be the first.
– Gaurav
Nov 15 '18 at 18:47