-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
TASK: Extract fonts to load seperatelty #821
Conversation
Hey! What about that remark that Jonas made? https://neos-project.slack.com/messages/C0U0KEGDQ/convo/C0U0KEGDQ-1502348659.634050/ As said, I'm not up to date on the topic. E.g. maybe our browser support would allow us to only ship woff2? That would reduce the download size. |
I've decided to include woff because of: http://caniuse.com/#search=woff vs http://caniuse.com/#search=woff2 IE11 isn't supporting woff2, but I think many of NeosCMS users has to be IE11 compatible. I'm not up to date which would be better either. But I can make a research on that topic. Maybe @jonas-siegl can say something more detailed about that? |
This is the only But maybe Bram isn't telling us everything. Also if the user already have the font the browser didn't have to redownload the font again which wouldn't be possible with inlining. |
Yeah, I had suspected something like this, just wasn't sure enough to insist. Also we can cache fonts very aggressively, but that's not something we want to do with CSS. |
@@ -33,8 +33,8 @@ const webpackConfig = { | |||
loader: 'json-loader' | |||
}, | |||
{ | |||
test: /\.(woff|woff2|eot|svg)$/, | |||
loader: 'url-loader?limit=100000' | |||
test: /\.(woff|woff2)$/, |
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.
I think this loader can be dropped, since it is removed from the package.json.
Any reasons, why it's still here?
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.
Current implementation of font-awesome.
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.
In that case you shouldn't remove the loader from the dependencies, right? https://github.com/neos/neos-ui/pull/821/files/b0242e333c0d12bf7fbeb031e3c6fe10a2831143#diff-6e183e897d30da3e86a99a9c16857780L52
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.
It was working like this before I implemented the typeface-work-sans npm module and it is working again, the loader was added because of errors during the build with this module, why should I add a dependency I don't need?
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.
Because you are still using it. The loader "url?limit=100000" is a shortcut for "url-loader?limit=100000". Webpack automatically appends "-loader" to it when the first module lookup failed. Maybe it's still working because another package has the module "url-loader" as a dependency.
Anyway I would recommend to not use the short syntax because it can lead to strange issues if there is another module called "url". Therefore this logic has been removed in Webpack 2 by default. (see webpack/webpack#2986)
Hey, |
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.
Ok, so let's finish this PR the way it is. Left some comments.
Configuration/Settings.yaml
Outdated
@@ -34,6 +34,15 @@ Neos: | |||
'Neos.Neos.UI:HostOnlyStyles': | |||
resource: '${"resource://" + Neos.Ui.StaticResources.compiledResourcePackage() + "/Public/Styles/HostOnlyStyles.css"}' | |||
position: 'start 900' | |||
'WorkSans:200': |
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.
Ehh you can't load the font like this, it ain't no webpack... ;)
You need to do smth like this CSS:
@font-face {
font-family: "WorkSans";
src: url("/...pathetofonts/work-sans-latin-200.woff") format("woff");
font-weight: normal;
font-style: normal;
}
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.
Also, if we switched from NotoSans to WorkSans (why?) you need to also change the family here: https://github.com/neos/neos-ui/blob/master/packages/neos-ui/src/styleHostOnly.css#L8
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.
Also, do we really need all three weights? As far as I can see in the UI we only use normal and bold weights.
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.
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.
@dimaip We switched because of this, I think: https://github.com/neos/brand/blob/2f2fe306f0ce1c5ee2ca7345c51464134cfad247/index.js#L23
Is it possible, that the brand assets are used for both, the website and the UI?
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.
@grebaldi what do you mean by brand assets?
I don't mind WorkSans, we just have to use it here: https://github.com/neos/neos-ui/blob/master/packages/neos-ui/src/styleHostOnly.css#L8
Preferably by using brand constants of course.
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.
@grebaldi @dimaip the referenced "brand-assets" is a package where the colors and fonts of Neos are defined, and yes they where used in the website back when I started it, this difference is ofc now kind of problematic.
Was the change in font families meant to be just for the website or the whole brand of Neos? In the latter case ofc it makes sense to also change it in the UI doesnt it?
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.
@Inkdpixels hey nice to see you here again!
I'm sure it was just a mistake, we should use the definition from the brands package ofc.
Can we then remove the worksans npm package? |
Oh, sorry, missed it! |
So, everything alright then? :) |
As you see, I approved your PR, but didn't push the green button myself, as I'm scared to take the final responsibility 😆 |
closes #816
@dimaip