upash / peco

nothing here, move on..
MIT License
209 stars 12 forks source link

Query page data at build time in themes #13

Closed egoist closed 6 years ago

egoist commented 6 years ago

If you want to display the data for page /about on page /:

index.vue:

<script>
import { queryPage } from 'peco/macro'

const page = queryPage`/about`

export default {
    data() {
        return {
            page
        }
    }
}
</script>

This can be implemented via webpack-loader + babel plugin:

import { queryPage } from 'peco/macro'

const page = queryPage`/about`

is transformed to:

const page = require('peco-query-loader?type=queryPage&value=/about')