-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat(fonts): add lyon font #194
Conversation
f5fb072
to
3d3c528
Compare
Could we use kebab case for the names of the fonts? just for consistency with roboto, e.g.:
|
docs/USAGE.md
Outdated
|
||
When you include the canopy.css file in your project, it will try to load the font from that exact path. If your font files are in the wrong location, or have a typo in the filename, the Lyon font won't load correctly. | ||
|
||
#### How is Lyon omitted? |
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'm not sure we need this here? Users don't really have to know this 🤔
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 was wondering about this too. In the end I decided to include it to help future developers, should they need to alter the Webpack config or add another commercial font. So if we were to keep it in some way, perhaps it should go into CONTRIBUTING.md - or maybe just remove it entirely 🤔 . What's your preference? I'm happy to go with the consensus on this (CC @thatguynamedandy, @paul-request and @aaronBery)
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.
Maybe I'd move it to CONTRIBUTING.md
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 it would be better in CONTRIBUTING.md, or I would actually favour putting it in the git commit message (which is personal preference more than anything)
Done ✅ |
Presentation and layout looks good. The example page is showing Lyon styles below Here is are the specs for allowed Lyon styles: |
Thanks Alex, those example have been removed 👍 |
592ea9d
to
e16609c
Compare
docs/USAGE.md
Outdated
|
||
Canopy consists of two fonts; Roboto and Lyon. Roboto is included in the distributed Canopy package, and will load automatically when you have installed Canopy correctly. | ||
|
||
Due to our commericial license agreement, Lyon is not included in the Canopy distributed package, so you need to include it in the **assets** directory of your application. Canopy still references Lyon in the \`\`@font-face\`\` rulesets, so you don't need to implement them, but you do need to ensure that the path to the font in your assets directory is the same as the paths specified by Canopy in \`\`@font-face\`\`. |
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.
Due to our commericial license agreement, Lyon is not included in the Canopy distributed package, so you need to include it in the **assets** directory of your application. Canopy still references Lyon in the \`\`@font-face\`\` rulesets, so you don't need to implement them, but you do need to ensure that the path to the font in your assets directory is the same as the paths specified by Canopy in \`\`@font-face\`\`. | |
Due to commercial licensing agreements the Lyon font is not included in the distributed package. You will need to manually add it to the **assets** directory of your application. Canopy does provide the css to work with the font and no additional code should be required. You will need to ensure the font is in the directory specified by Canopy. |
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.
Ah that's better, thanks Andy. Done ✅
|
||
Due to our commericial license agreement, Lyon is not included in the Canopy distributed package, so you need to include it in the **assets** directory of your application. Canopy still references Lyon in the \`\`@font-face\`\` rulesets, so you don't need to implement them, but you do need to ensure that the path to the font in your assets directory is the same as the paths specified by Canopy in \`\`@font-face\`\`. | ||
|
||
Canopy's path for Lyon is **/assets/fonts/lyon/**, therefore you need to put the font files in the following location: |
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 there is a line to add here along the lines of...
Please ensure you have the correct licensing agreement in place before using the Lyon font in your application.
I would like to be able to link that text to somewhere, but not sure where.
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 ✅
docs/USAGE.md
Outdated
|
||
When you include the canopy.css file in your project, it will try to load the font from that exact path. If your font files are in the wrong location, or have a typo in the filename, the Lyon font won't load correctly. | ||
|
||
#### How is Lyon omitted? |
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 it would be better in CONTRIBUTING.md, or I would actually favour putting it in the git commit message (which is personal preference more than anything)
|
||
## Serving the Lyon font files | ||
|
||
Due to our commericial license agreement, Lyon is not included in the Canopy distributed package, so you need to include it in the **assets** directory of your application. Canopy still references Lyon in the \`\`@font-face\`\` rulesets, so you don't need to implement them, but you do need to ensure that the path to the font in your assets directory is the same as the paths specified by Canopy in \`\`@font-face\`\`. |
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.
The repetition of documentation between storybook and github is a bit annoying, but maybe one for a later date. Ideally all of our docs will be in one place (even if they are visible in Github and Storybook)
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.
Yes good point. I wonder if we could have snippets of markdown that can be imported and used in more than one place if needed. Shall we capture this in an issue?
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.
Could be worth tracking, a hard one to fix, but it might link partially to #35
@@ -1,5 +1,53 @@ | |||
@import '../styles/mixins.scss'; | |||
$fonts-path: '../assets/fonts' !default; | |||
$fonts-path-lyon: '/assets/fonts' !default; |
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 this is a default
does that mean that people could potentially override this property if they are including the scss files? Just wondering if we document that?
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've removed the default
, I think it just came from duplicating the line above to edit it. Having it there does indicate that this var could be changed, but in reality it should stay the same.
webpack.global.config.js
Outdated
loader: 'css-loader', | ||
options: { | ||
url: (url) => { | ||
// TODO: use regex for more precise targeting |
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.
Have you done the TODO?
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.
Yes, I did it but forgot to remove the comment 🤦
docs/USAGE.md
Outdated
The custom Webpack config does two things when compiling Canopy's global CSS file (canopy.css): | ||
|
||
1. Prevents `css-loader` from transforming any URL referencing the Lyon font. This means the path will stay as relative to the base URL of the consuming application, therefore looking in the assets directory of consuming app. | ||
2. Removes the Lyon font files from the /dist directory after complication is complete, using `remove-files-webpack-plugin`. |
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.
Typo: complication
-> compilation
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 ✅
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.
Nice work @owensgit 🎊
ff87f80
to
6edb744
Compare
The Roboto font is stored in **/projects/canopy/src/assets/fonts/roboto** as normal and is included in the distributed Canopy package. The Lyon font files are stored in **/assets/fonts** and ommitted from the distributed package via the Webpack config. The `css-loader` options prevent it from transforming any URL referencing the Lyon font. This means the path will stay as relative to the base URL of the consuming application (/assets/fonts), therefore looking in the assets directory of consuming app.
🎉 This PR is included in version 5.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Description
Adds the Lyon font with a suggested solution for not including it as part of the distributed Canopy package.
I've added an explanation to the USAGE.md doc and also to the Typography notes. Please take a look - hopefully the explanation is clear, but shout if not and I can improve it.
I also updated the Typography story view to display both fonts side by side with a pangram:
Without notes:
With notes:
Requirements
You can test that it works correctly by building the Canopy package locally, checking that the generated package does not include the Lyon font files. Then, copy the package the node_modules of your consuming application and follow the instructions to include the font in your assets directory. You should then be able to use the font modifier.
Storybook link: https://deploy-preview-194--legal-and-general-canopy.netlify.app/?path=/story/typography--headings
Checklist:
TODO
Input()
to the Heading component to apply the Lyon font (pending discussion)