New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

x-postpress

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

x-postpress

A Web Component that fetches [WordPress](https://wordpress.org/) posts [from the REST API](https://developer.wordpress.org/rest-api/reference/posts/#list-posts) based on attributes set on the element.

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-68.18%
Maintainers
1
Weekly downloads
 
Created
Source

x-postpress

A Web Component that fetches WordPress posts from the REST API based on attributes set on the element.

About

Try

Use

  • Add the Web Component to the project (unpkg and npm examples)

    1. load the custom element using a script tag (from unpkg):

      <script type="module" src="https://unpkg.com/x-postpress"></script>
      
    2. Alternatively, try adding using the command line...

      npm i x-postpress
      

      ...then import the module from another file:

      import 'x-postpress'
      
  • Add the tag into the document and style using available CSS custom properties. Articles can be included with the provided slot element:

    <style>
      ul {
        list-style-type: var(--ul-list-style-type, inherit);
      }
    
      x-postpress {
        --ul-list-style-type: none;
      }
    </style>
    
    <x-postpress
      apiHost="https://content.example.com"
      per_page="1"
    >
      <div slot="articles">
        <article>
          <h1><a href="https://example.com/1970/01/01/slotted/">
            Article
          </a></h1>
          <h2>Thursday, 01 January 1970</h2>
          <p>Lorem ipsum dolor sit amet</p>
          <hr>
        </article>
      </div>
    </x-postpress>
    

Misc

  • Other examples are available in a dedicated folder
  • Try using the browser's devtools to change the apiUrl attribute within the x-postpress tag to render another REST API posts endpoint
  • If using the included index.html, a link can be created to the page, and the custom element attributes can be overridden by including them in the query string (example):
    <a href="http://localhost:8081/?apiHost=https://content.example.com">example.com</a>
    

Keywords

FAQs

Package last updated on 21 Jan 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc