Skip to content

Commit

Permalink
Merge branch 'master' into sidebar
Browse files Browse the repository at this point in the history
merge branch master into sidebar
  • Loading branch information
nblthree committed May 28, 2019
2 parents eb7c8dc + a7e2d08 commit 4d2e31a
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 13 deletions.
6 changes: 6 additions & 0 deletions packages/saber-plugin-pwa/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.3.3](https://github.com/saberland/saber/compare/[email protected]@0.3.3) (2019-05-28)

### Bug Fixes

- **deps:** update snackbar version ([#216](https://github.com/saberland/saber/issues/216)) ([bc7acc0](https://github.com/saberland/saber/commit/bc7acc0))

## [0.3.2](https://github.com/saberland/saber/compare/[email protected]@0.3.2) (2019-05-24)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions packages/saber-plugin-pwa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "saber-plugin-pwa",
"version": "0.3.2",
"version": "0.3.3",
"description": "Add PWA support for your Saber app.",
"license": "MIT",
"main": "lib/index.js",
Expand All @@ -12,7 +12,7 @@
"saber": "^0.6.2"
},
"dependencies": {
"@egoist/snackbar": "^1.1.0",
"@egoist/snackbar": "^1.2.1",
"stringify-attributes": "^2.0.0",
"workbox-build": "^4.3.1",
"workbox-window": "^4.3.1"
Expand Down
7 changes: 7 additions & 0 deletions packages/saber-plugin-query-posts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.3.2](https://github.com/saberland/saber/compare/[email protected]@0.3.2) (2019-05-28)

### Features

- **saber-plugin-query-posts:** add firstPageOnly option ([995711c](https://github.com/saberland/saber/commit/995711c))
- **saber-plugin-query-posts:** allow to configure pagination for each page separately ([fba8833](https://github.com/saberland/saber/commit/fba8833))

## [0.3.1](https://github.com/egoist/saber/compare/[email protected]@0.3.1) (2019-05-21)

### Bug Fixes
Expand Down
7 changes: 7 additions & 0 deletions packages/saber-plugin-query-posts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ injectAllPosts:

The limit of posts to show per page.

### firstPageOnly

- Type: `boolean`
- Default: `false`

Only generate the first page of posts.

### tagsMap

- Type: `{ [name: string]: string }`
Expand Down
3 changes: 2 additions & 1 deletion packages/saber-plugin-query-posts/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ exports.apply = (api, options = {}) => {
tagsMap: options.tagsMap,
categoriesMap: options.categoriesMap,
paginationOptions: {
perPage: options.perPage || 30
perPage: options.perPage || 30,
firstPageOnly: options.firstPageOnly
},
permalinks: Object.assign(
{
Expand Down
5 changes: 5 additions & 0 deletions packages/saber-plugin-query-posts/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ const slugify = require('slugo')

function paginate(arr, options) {
options = Object.assign({ perPage: 30 }, options)

if (options.firstPageOnly) {
return [arr.slice(0, options.perPage)]
}

const totalPages = Math.ceil(arr.length / options.perPage)
const result = []
for (let i = 0; i < totalPages; i++) {
Expand Down
2 changes: 1 addition & 1 deletion packages/saber-plugin-query-posts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "saber-plugin-query-posts",
"version": "0.3.1",
"version": "0.3.2",
"files": [
"lib"
],
Expand Down
14 changes: 14 additions & 0 deletions packages/saber/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.6.5](https://github.com/saberland/saber/compare/[email protected]@0.6.5) (2019-05-28)

### Bug Fixes

- **vue-renderer:** default slot might not exist ([91132a2](https://github.com/saberland/saber/commit/91132a2))
- check for port only in initial setConfig run ([#215](https://github.com/saberland/saber/issues/215)) ([d778282](https://github.com/saberland/saber/commit/d778282))
- only check port once ([0b861c4](https://github.com/saberland/saber/commit/0b861c4))
- support beforePlugins hook in saber-node.js ([9b12cd2](https://github.com/saberland/saber/commit/9b12cd2))

### Features

- add beforePlugins hook ([dd018d5](https://github.com/saberland/saber/commit/dd018d5))
- add onUpdateConfigFile hook ([de8574f](https://github.com/saberland/saber/commit/de8574f))

## [0.6.4](https://github.com/saberland/saber/compare/[email protected]@0.6.4) (2019-05-25)

### Bug Fixes
Expand Down
12 changes: 8 additions & 4 deletions packages/saber/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,22 @@ class Saber {
this.configDir = null
}

const initialRun = !this.config
this.config = merge({}, config, this.initialConfig)
// Validate config, apply default values, normalize some values
this.config = require('./utils/validateConfig')(this.config, {
dev: this.dev
})

// Make sure the port is available
const { port } = this.config.server
this.config.server._originalPort = port
this.config.server.port = await getPort({
port: getPort.makeRange(port, port + 1000),
host: this.config.server.host
})
if (initialRun) {
this.config.server.port = await getPort({
port: getPort.makeRange(port, port + 1000),
host: this.config.server.host
})
}
}

applyPlugin(plugin, options, pluginLocation) {
Expand Down
2 changes: 1 addition & 1 deletion packages/saber/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "saber",
"version": "0.6.4",
"version": "0.6.5",
"files": [
"bin",
"lib",
Expand Down
32 changes: 32 additions & 0 deletions website/pages/docs/images-fonts-and-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Images, Fonts and Files
layout: docs
---

## Using `import` or `require`

With Webpack, using static assets like images and fonts works similarly to CSS.

You can __`import` or `require` a file right in a JavaScript module or Vue component__. This tells Webpack to include that file in the bundle. Unlike CSS imports, importing a file gives you a string value. This value is the final path you can reference in your code, e.g. as the `src` attribute of an image or the `href` of a link to a PDF.
Expand Down Expand Up @@ -34,3 +36,33 @@ Since markdown pages are also compiled to Vue components, asset URLs will also b
```

Note that we only convert __relative URLs__, like `image.png`, `../image.png` but not `/image.png` or `https://example.com/image.png`.

## Using the `assets` page attribute

In pages, you can use the `assets` attribute to import static assets.

```markdown
---
assets:
cover: ./cover.png
---
```

You can use any relative path here, like `./cover.png`, `../images/photo.jpg`. `@` (alias to project root) is also supported, for example: `@/images/cover.png`.

Then use them in your layout component:

```vue
<template>
<div>
<!-- page.attributes.assets.cover will be an absolute url -->
<img :src="page.attributes.assets.cover" alt="cover">
</div>
</template>
<script>
export default {
props: ['page']
}
</script>
```
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,10 @@
postcss-load-config "^2.0.0"
schema-utils "^1.0.0"

"@egoist/snackbar@^1.1.0":
version "1.1.0"
resolved "https://registry.npmjs.org/@egoist/snackbar/-/snackbar-1.1.0.tgz#338d3bae9e96c20b37ce98e29b1710e7b30094fb"
integrity sha512-iNTXCXb6ypuDY2fXBBPsVbLyh97hAy83iaNNdlpt1paimloXiw6MfoYyHP7eV/l+QL8vPB2A8Kokjqt9CmU9wQ==
"@egoist/snackbar@^1.2.1":
version "1.2.1"
resolved "https://registry.npmjs.org/@egoist/snackbar/-/snackbar-1.2.1.tgz#1dc9f4227addb038d2dbeb0b08da8a0ca756cdc5"
integrity sha512-s0JpojDd/YlzgppQrQW44d10uijrdU929BfF4Vg8tg1O1wZ2+SgXaCS/lB9U8cClHc0tiSnI0KUD0SVdeoDGbQ==

"@hapi/[email protected]":
version "2.0.0"
Expand Down

0 comments on commit 4d2e31a

Please sign in to comment.