Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@patternfly/pfelement
Advanced tools
This is the base element that all other PFElements should extend. It handles setting up a shadow root and applies Shady CSS if it is needed.
To create a new PFElement, use npm run new
from the root of the PFElements repo. After answering a few questions, a new element will be generated for you by generator-pfelement.
Here is an example of a new element and how it extends the base PFElement.
import PFElement from "../pfelement/pfelement.js";
class MyElement extends PFElement {
// The HTML tag name for this element. This will be passed into `customElements.define()`.
static get tag() {
return "my-element";
}
// The path to the element's SCSS file. It is compiled to CSS at build time.
get styleUrl() {
return "my-element.scss";
}
// The path to the element's template. This used at build time.
get templateUrl() {
return "my-element.html";
}
constructor() {
// The call to super is first and contains a reference to the class itself.
// This allows the base class to see any of MyElement's static properties.
super(MyElement);
// any other work to do during the constructor goes here
}
// connectedCallback runs when the element is placed into the DOM. Note that
// in dynamic apps, this _can_ happen more than once, for instance if an
// element is moved from one part of the DOM tree to another.
connectedCallback() {
// super's connectedCallback goes first
super.connectedCallback();
// any other work to do during connectedCallback goes here
}
}
PFElement.create(MyElement);
npm run test
npm run build
From the PFElements root directory, run:
npm start
PFElement (and all PFElements) use Prettier to auto-format JS and JSON. The style rules get applied when you commit a change. If you choose to, you can integrate your editor with Prettier to have the style rules applied on every save.
FAQs
Base class for PatternFly Elements
The npm package @patternfly/pfelement receives a total of 840 weekly downloads. As such, @patternfly/pfelement popularity was classified as not popular.
We found that @patternfly/pfelement demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.