Giter Club home page Giter Club logo

cloak's Introduction

Cloak

Opinionated Nuxt + Craft boilerplate.

Install

  1. Copy the scaffold contents to your project
  2. Make a package.json that includes Nuxt and Cloak: yarn add nuxt @bkwld/cloak

Usage

From your project's nuxt.config.coffee:

# Make boilerplate, setting some options
{ mergeConfig, makeBoilerplate } = require '@bkwld/cloak'
boilerplate = makeBoilerplate
  siteName: 'My Site'
  pageTypenames: ['towers_towers_Entry']

# Merge project specific config with cloak boilerplate
module.exports = mergeConfig boilerplate,

  # Append additional internal routes for vue-routing-anchor-parser
  anchorParser: internalUrls: [
    /^https?:\/\/(www)?\.domain\.com/
  ]

  # Customize routes
  router: extendRoutes: (routes, resolve) ->

    # Make all path params required in detail routes
    detailRoutes = ['blog-tag-tag', 'blog-category-article']
    routes.filter ({ name }) -> name in detailRoutes
    .forEach (route) -> route.path = route.path.replace /\?/g, ''

    # Append routes from boilerplate
    return boilerplate.router.extendRoutes routes, resolve

Options

These are options you can pass to makeBoilerplate. See the source code for defaults.

Property Description
siteName Name of site gets prepended to the <title> and used in PWA manifest.
polyfills Array of polyfill.io keywords, for example URL.
pageTypenames Array of Craft _typename values for page sections. These will be queried nad turned into routes.
repoName The Sentry webpack plugin's repo value, for example Group Name / Project Name.
imgixUrl For example, https://project.imgix.net
srcsetWidths Array of integer widths that are used to make the Craft Visual srcSet.
placeholderColor The default placeholder color for Craft Visual

Libraries

Besides providing a bunch of nuxt.config boilerplate, this project also provides these shared resources:

  • components - Vue components that are already setup for autodiscovery with no prefixing.
  • fragments - GraphQL fragments for common objects
  • mixins - Vue mixins
  • services - Libraries of methods that can be imported into your code and which are also injected globally. For example, @$craft and @$defer are available in all components.

Notes

  • Using cjs module syntax for to make developing via yarn link simpler. I tried using esm package but it ran into issues with imports of imports.
  • Using a fork of webpack-graphql-loader to work around issues with the loader not being found from the root package. I think because it referenced some old and unecessary deps.
  • Use the Page View dataLayer event for firing Page View style tags from GTM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.