forked from nuxt-modules/google-fonts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 87bfe85
Showing
19 changed files
with
12,289 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_size = 2 | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Common | ||
node_modules | ||
dist | ||
.nuxt | ||
coverage | ||
|
||
# Plugin | ||
lib/plugin.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'@nuxtjs' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
# os: [ubuntu-latest, macos-latest, windows-latest] | ||
# node: [10, 12] | ||
os: [ubuntu-latest] | ||
node: [10] | ||
|
||
steps: | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: cache node_modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: node_modules | ||
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }} | ||
|
||
- name: Install dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: yarn | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Test | ||
run: yarn test | ||
|
||
- name: Coverage | ||
uses: codecov/codecov-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
node_modules | ||
*.iml | ||
.idea | ||
*.log* | ||
.nuxt | ||
.vscode | ||
.DS_Store | ||
coverage | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Nuxt Community | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# @nuxtjs/google-fonts | ||
|
||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href] | ||
[![Codecov][codecov-src]][codecov-href] | ||
[![License][license-src]][license-href] | ||
|
||
> [Google Fonts](https://developers.google.com/fonts) module for [NuxtJS](https://nuxtjs.org) | ||
[📖 **Release Notes**](./CHANGELOG.md) | ||
|
||
## Features | ||
|
||
- Parse head links to Google Fonts | ||
- Creates only an external link to Google Fonts | ||
- [Support CSS API v2](https://developers.google.com/fonts/docs/css2) | ||
- [Add dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch) | ||
- [Add preconnect](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch#Best_practices) | ||
- Download css/fonts to local project (No need external resources) | ||
- Encode fonts to base64 | ||
|
||
## Setup | ||
|
||
1. Add `@nuxtjs/google-fonts` dependency to your project | ||
|
||
```bash | ||
yarn add --dev @nuxtjs/google-fonts # or npm install --save-dev @nuxtjs/google-fonts | ||
``` | ||
|
||
2. Add `@nuxtjs/google-fonts` to the `buildModules` section of `nuxt.config.js` | ||
|
||
```js | ||
{ | ||
buildModules: [ | ||
// Simple usage | ||
'@nuxtjs/google-fonts', | ||
|
||
// With options | ||
['@nuxtjs/google-fonts', { /* module options */ }] | ||
] | ||
} | ||
``` | ||
|
||
:warning: If you are using Nuxt **< v2.9** you have to install the module as a `dependency` (No `--dev` or `--save-dev` flags) and use `modules` section in `nuxt.config.js` instead of `buildModules`. | ||
|
||
### Using top level options | ||
|
||
```js | ||
export default { | ||
buildModules: [ | ||
'@nuxtjs/google-fonts' | ||
], | ||
googleFonts: { | ||
/* module options */ | ||
} | ||
} | ||
``` | ||
|
||
## Development | ||
|
||
1. Clone this repository | ||
2. Install dependencies using `yarn install` or `npm install` | ||
3. Start development server using `npm run dev` | ||
|
||
## License | ||
|
||
[MIT License](./LICENSE) | ||
|
||
Copyright (c) Nuxt Community | ||
|
||
<!-- Badges --> | ||
[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/google-fonts/latest.svg | ||
[npm-version-href]: https://npmjs.com/package/@nuxtjs/google-fonts | ||
|
||
[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/google-fonts.svg | ||
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/google-fonts | ||
|
||
[github-actions-ci-src]: https://github.com/nuxt-community/google-fonts/workflows/ci/badge.svg | ||
[github-actions-ci-href]: https://github.com/nuxt-community/google-fonts/actions?query=workflow%3Aci | ||
|
||
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/google-fonts.svg | ||
[codecov-href]: https://codecov.io/gh/nuxt-community/google-fonts | ||
|
||
[license-src]: https://img.shields.io/npm/l/@nuxtjs/google-fonts.svg | ||
[license-href]: https://npmjs.com/package/@nuxtjs/google-fonts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
extends: [ | ||
'@commitlint/config-conventional' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
rootDir: __dirname, | ||
buildModules: [ | ||
{ handler: require('../') } | ||
], | ||
head: { | ||
link: [ | ||
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto&display=swap' } | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<div> | ||
Works! | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
hooks: { | ||
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS', | ||
'pre-commit': 'yarn lint', | ||
'pre-push': 'yarn lint' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
collectCoverage: true, | ||
collectCoverageFrom: ['lib/**/*.js', '!lib/plugin.js'], | ||
testEnvironment: 'node' | ||
} |
Oops, something went wrong.