diff --git a/packages/saber-plugin-pwa/CHANGELOG.md b/packages/saber-plugin-pwa/CHANGELOG.md index b9c880153..d35ed4d2f 100644 --- a/packages/saber-plugin-pwa/CHANGELOG.md +++ b/packages/saber-plugin-pwa/CHANGELOG.md @@ -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/saber-plugin-pwa@0.3.2...saber-plugin-pwa@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/saber-plugin-pwa@0.3.1...saber-plugin-pwa@0.3.2) (2019-05-24) ### Bug Fixes diff --git a/packages/saber-plugin-pwa/package.json b/packages/saber-plugin-pwa/package.json index 67cbf4fbd..de7c0195a 100644 --- a/packages/saber-plugin-pwa/package.json +++ b/packages/saber-plugin-pwa/package.json @@ -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", @@ -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" diff --git a/packages/saber-plugin-query-posts/CHANGELOG.md b/packages/saber-plugin-query-posts/CHANGELOG.md index 1b5308cf7..679779622 100644 --- a/packages/saber-plugin-query-posts/CHANGELOG.md +++ b/packages/saber-plugin-query-posts/CHANGELOG.md @@ -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/saber-plugin-query-posts@0.3.1...saber-plugin-query-posts@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/saber-plugin-query-posts@0.3.0...saber-plugin-query-posts@0.3.1) (2019-05-21) ### Bug Fixes diff --git a/packages/saber-plugin-query-posts/README.md b/packages/saber-plugin-query-posts/README.md index bf27beeb7..2cd045a7f 100644 --- a/packages/saber-plugin-query-posts/README.md +++ b/packages/saber-plugin-query-posts/README.md @@ -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 }` diff --git a/packages/saber-plugin-query-posts/lib/index.js b/packages/saber-plugin-query-posts/lib/index.js index c002057bf..6b0bb8d9a 100644 --- a/packages/saber-plugin-query-posts/lib/index.js +++ b/packages/saber-plugin-query-posts/lib/index.js @@ -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( { diff --git a/packages/saber-plugin-query-posts/lib/utils.js b/packages/saber-plugin-query-posts/lib/utils.js index ea4390b24..1fc8082ed 100644 --- a/packages/saber-plugin-query-posts/lib/utils.js +++ b/packages/saber-plugin-query-posts/lib/utils.js @@ -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++) { diff --git a/packages/saber-plugin-query-posts/package.json b/packages/saber-plugin-query-posts/package.json index e0aeef5fc..a0ff67cce 100644 --- a/packages/saber-plugin-query-posts/package.json +++ b/packages/saber-plugin-query-posts/package.json @@ -1,6 +1,6 @@ { "name": "saber-plugin-query-posts", - "version": "0.3.1", + "version": "0.3.2", "files": [ "lib" ], diff --git a/packages/saber/CHANGELOG.md b/packages/saber/CHANGELOG.md index 3eb5b6244..a12c21991 100644 --- a/packages/saber/CHANGELOG.md +++ b/packages/saber/CHANGELOG.md @@ -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/saber@0.6.4...saber@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/saber@0.6.3...saber@0.6.4) (2019-05-25) ### Bug Fixes diff --git a/packages/saber/lib/index.js b/packages/saber/lib/index.js index 3e4f1438b..398c52509 100644 --- a/packages/saber/lib/index.js +++ b/packages/saber/lib/index.js @@ -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) { diff --git a/packages/saber/package.json b/packages/saber/package.json index 81bfd29e0..72e1dba77 100644 --- a/packages/saber/package.json +++ b/packages/saber/package.json @@ -1,6 +1,6 @@ { "name": "saber", - "version": "0.6.4", + "version": "0.6.5", "files": [ "bin", "lib", diff --git a/website/pages/docs/images-fonts-and-files.md b/website/pages/docs/images-fonts-and-files.md index 3ca328e49..3d681b8f3 100644 --- a/website/pages/docs/images-fonts-and-files.md +++ b/website/pages/docs/images-fonts-and-files.md @@ -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. @@ -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 + + + +``` diff --git a/yarn.lock b/yarn.lock index 37ebf2417..612c1d771 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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/address@2.x.x": version "2.0.0"