makestatic-page-id

2.0.0 • Public • Published

Page Identifier

Generate a page identifier

Generates a page identifier to expose to template locals for CSS scoping.



Install

yarn add makestatic-page-id

API

identifier

identifier(ctx)

Generates an identifier for a file.

Useful when exposing template locals so that the identifier can be assigned to an element to allow easier CSS scoping.

The generated identifier is equal to the file name with the file extension removed unless the page is an index page.

If the page is an index page and is not at the context root the name of the parent directory is used, if the index page is at the root then the file name is used.

identifier({resourcePath: '/index.html'})      // index
identifier({resourcePath: '/features.html'})   // features
identifier({resourcePath: '/api/index.html'})  // api

Returns a page identifier.

  • ctx Object the webpack loader context.

License

MIT


Created by mkdoc on March 12, 2017

Readme

Keywords

Package Sidebar

Install

npm i makestatic-page-id

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

4.26 kB

Total Files

3

Last publish

Collaborators

  • muji
  • tmpfs