Skip to content
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

add support for codepoints so values are never overwritten #49

Merged
merged 9 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .fantasticonrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
const codepoint = require('./src/reserved-codepoints.json');
module.exports = {
inputDir: './src/optimized-icons', // (required)
outputDir: './src/generated', // (required)
fontTypes: ['ttf', 'woff', 'woff2'],
assetTypes: ['scss'],
assetTypes: ['scss', 'html', 'json'],
prefix: 'pi',
name: "platform-icons"
tag: 'i',
name: 'platform-icons',
fontHeight: 300,
normalize: true,
templates: {
html: './src/templates/html.hbs'
},
codepoints: codepoint
};
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Ignore generated files
src/generated/*
!src/generated/.gitkeep

src/optimized-icons/*.svg
!src/optimized-icons/.gitkeep

Expand All @@ -14,4 +13,4 @@ dist-ssr
*.local

# Ignore package files
*.tgz
*.tgz
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,42 @@ import 'path/to/node_modules/@ritterim/platform-icons/dist/style.css'
5. To start dev server, run `npm start`
6. To create package, run `npm run pack`

## SVG Setup for Contributing

Some notes on svg setup

| source | default |
|---|---|
| artboard | 4" x 4" |
| main stroke | 24pt |
| auxiliary stroke | 18pt |
| corner | .15" |
| join | round |

- Use compound paths (remember, there is no white 😜)
- Expand to outlines

## Codepoints

Codepoints are the hexadecimal pointer to an icon. Here, they're used to target icons in CSS using `:before`:

```html
<i class="pi-platfrom-ui"></i>

<style>
.pi-platform-ui:before {
content: "\f18f";
}
</style>
```

Each time the icon set is generated there's a chance these pointers may shift. To avoid this, we copy `/generated/platform-icons.json` map to `reserved-codepoints.json` to maintain the current label-to-codepoint map so codepoints don't change.

## Dependencies
- [SVGO](https://github.com/svg/svgo) - used to optimize all SVG icons
- [Fantasticon](https://github.com/tancredi/fantasticon) - used to build icon fonts
- [Vite](https://github.com/vitejs/vite) - used for dev server and building library
- Vite Plugins:
- [vite-plugin-banner](https://github.com/chengpeiquan/vite-plugin-banner) - used to prepend licensing info
- [rollup-plugin-copy](https://github.com/vladshcherbin/rollup-plugin-copy) - used to copy generated font files to the public directory
- [rollup-plugin-copy](https://github.com/vladshcherbin/rollup-plugin-copy) - used to copy generated font files to the public directory
- [vite-plugin-handlebars](https://github.com/alexlafroscia/vite-plugin-handlebars)- used to run the handlebars templates
36 changes: 10 additions & 26 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
environment:
matrix:
- nodejs_version: STABLE
configuration: publish
- nodejs_version: LTS

install:
Expand All @@ -17,31 +15,17 @@ build_script:

cache:
- node_modules -> package.json, package-lock.json
- '%APPDATA%\npm-cache'

test: off

artifacts:
- path: ./icons.zip
name: Icons
type: Zip

deploy:
- provider: Environment
name: Azure App Service Zip (Development)
artifact: Icons
slot: staging
app_name: rim-icons-east-dev
deploy_script:
- ps: |
if ($ENV:CONFIGURATION -eq "publish")
{
"//registry.npmjs.org/:_authToken=`$`{NPM_TOKEN`}" | Out-File (Join-Path $ENV:APPVEYOR_BUILD_FOLDER ".npmrc") -Encoding UTF8
iex "npm pack"
iex "npm publish"
}
on:
branch: master
configuration: publish

after_deploy:
- ps: |
if ($ENV:CONFIGURATION -eq "publish")
{
"@ritterim:registry=https://ritterim.myget.org/F/npm/npm/`r`n//ritterim.myget.org/F/npm/npm/:_authToken=`$`{MYGET_TOKEN`}" | Out-File (Join-Path $ENV:APPVEYOR_BUILD_FOLDER ".npmrc") -Encoding UTF8
iex "npm pack"
iex "npm publish"
}
on:
branch: master
branch: master
Loading