![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@hatchly/nuxt-pages-module
Advanced tools
Module to easily integrate with Hatchly pages
yarn add @hatchly/nuxt-pages-module
Register the module in your nuxt applications config file:
module.exports = {
// Nuxt config
modules: [
// Other Modules
['@hatchly/nuxt-pages-module', {
// Options
}],
],
hatchly: {
pages: {
// Options can also be defined here
},
},
};
The options object can contain the following values:
{
cacheTimeout: Number,
disableBackgroundFetch: Boolean,
},
Each option is described below.
cacheTimeout
The duration, in seconds, until the cached date is refreshed. The cache can be disabled completely by passing a falsey value.
3600
(1 hour)number|boolean
disableBackgroundFetch
By default, if the cache is enabled, all requests will still happen regardless, but will instead happen asynchronously on the server side after the cached data has been returned. Set this option to
true
to prevent this functionality entirely, and always rely on traditional caching.
false
boolean
Supply your graphql endpoint to the module via the publicRuntimeConfig
and privateRuntimeConfig
objects, e.g.:
module.exports = {
/** ... */
publicRuntimeConfig: {
/** ... */
GRAPHQL_ENDPOINT: process.env.API_GRAPHQL_URL,
},
/** ... */
privateRuntimeConfig: {
/** ... */
GRAPHQL_ENDPOINT: process.env.API_GRAPHQL_URL,
},
};
If the api is accessible on an internal address, you can skip dns lookup and replace the env variable in privateRuntimeConfig
object with a different variable pointing to this address.
This module will automatically install and register the nuxt-graphql-request module and set up the client.
It will also provide a helper for interacting with the client:
export default {
async asyncData({ app }) {
const data = await app.$hatchlyGraphQL(HomepageQuery, {
uri: $route.params.article,
});
return data;
},
};
This method accepts the following arguments:
$hatchlyGraphQL(query, variables)
query
The GraphQL query for the client.
undefined
string
or GraphQL ASTrequired
variables
Variables to pass into the query.
{}
object
$attr
HelperThis module provides an $attr()
helper method to the Vue instance. This is the safer way of accessing attributes. This is essentially a wrapper around the lodash/get
method, with a bit of extra flavour.
The default usage for this component assumes that your page data is available as this.page
within your page-level component, so ensure your data from GraphQL is returned in this form for this usage.
<!-- Get a single value -->
<h1>{{ $attr('header.title') }}</h1>
<!-- Get a single value with fallback value -->
<h2>{{ $attr('header.subtitle', 'My subtitle') }}</h2>
<!-- This is especially useful when performing loops where the data may not exist -->
<ul>
<li
v-for="item in $attr('content.items', [])"
:key="item.title"
>
{{ item.title }}
</li>
</ul>
If your top level data is different to page
you can specify a different object as the first argument, and the other arguments will shift accordingly.
<h1>{{ $attr(pageData, 'header.title') }}</h1>
You can also use this in sub components/loops as a safe alternative to nested data structures, where the first argument would be whatever dataset you were accessing.
<ul>
<li
v-for="item in $attr('content.items', [])"
:key="item.title"
>
{{ $attr(item, 'image.name') }}
</li>
</ul>
By default this method will do the following things to certain attribute types:
instance
automatically instead of having to access the full $attr('attribute.path.instance', [])
path./
in order to ensure correct navigations within the router.page-link
object, it will automatically prefix the uri with a /
in order to ensure correct navigations within the router.value
property, we return this by default instead of having to access the full $attr('attribute.path.value')
path.When using WYSIWYG attributes, it's recommended to use the provided <wysiwyg-attr />
component rather than manually binding to an element with v-html
. This component will convert the html to render functions and return the content within a tag you have provided, or div by default. Using render functions allows the html to be rendered as elements within the virtual dom that can easily inherit styling. It also allows for converting internal links to router transitions, rather than forcing an entirely new page load.
<wysiwyg-attr
:html="$attr('body.content')"
/>
This component accepts two props:
html
The value of your wysiwyg attribute.
''
string
tag
The tag of the wrapper component.
'div'
string
This module exposes a storybook integration to add the $attr
global and the WysiwygAttr
component. Simply pull the following module into your project, in the preview.js
file for example:
import '@hatchly/nuxt-pages-module/storybook';
FAQs
Official nuxt integration for the Hatchly/Pages module
The npm package @hatchly/nuxt-pages-module receives a total of 2 weekly downloads. As such, @hatchly/nuxt-pages-module popularity was classified as not popular.
We found that @hatchly/nuxt-pages-module demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.