Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.
/ blueprints Public archive

Module for Nuxt.js to create distributable micro-apps

License

Notifications You must be signed in to change notification settings

nuxt/blueprints

Repository files navigation

@nuxt/blueprints

Module for Nuxt.js to create distributable micro-apps

npm version npm downloads Circle CI Codecov License

🚧 WIP

This module is considered experimental and a work-in-progress.

Examples

Check the example for a simple blueprint example.

If you are looking for a more advanced example, have a look at the NuxtPress repository which is also build using blueprints.

Node v12.4 required

If you wish to run the example from this repo, you need to use at least Node v12.4.0 due to the use of static class features. Those are transpiled on release using @babel/plugin-proposal-class-properties, but the example runs from source.

Quick Docs

The blueprint module is a supercharged module container which supports autodiscovery of folders and resolving of templates/files.

Features:

  • Define a template by adding the template identifiers tmpl or template to the name (the template identifier is removed before Nuxt.js will build the files)
  • Files which are not templates are just copied if needed (small performance improvement)
  • Prefix template identifiers with a $ to replace the identifier with the blueprint instance id (instead of removing the template identifier)

Main methods

  • autodiscover(<rootDir>, { validate(<path>), filter(<parsed path>) }) Filter and validate callbacks are more or less the same, validate runs during walking the fs and receives the full path as string argument . Filter runs when the fs walking has finished and passes the result of path.parse as argument.

It returns the found files by type, where type is the name of the first level folder

  • resolveFiles(<files>, <pathPrefix>)

This method simply checks if a add<capitalize(type)> method exists. Eg if you have a first level folder plugins then it will call the addPlugins method with the list of files. If the corresponding method doesnt exists then its assumed it are just generic files (or templates) which need to be copied. The pathPrefix argument is the folder in buildDir into which the files will be copied (i.e. if you set this to 'my-id' then all the blueprint files/templates are copied into .nuxt/my-id)

It returns a mapping of the src to dst for all files

Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using npm run dev

License

MIT License

Copyright (c) Nuxt.js Team

About

Module for Nuxt.js to create distributable micro-apps

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages