npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

optimizepress-ui

v0.2.22

Published

Style framework for OptimizePress Wordpress plugins.

Downloads

25

Readme

OptimizePress UI

This package contains all the global styles and scripts used throughout OptimizePress plugins.

It contains Bootstrap 4 and FontAwesome 4, but all the class names are prefixed with 'opui-', so to use bootstrap you need to prefix it in you HTML:

<a href="#" class="opui-btn opui-btn-primary>Button example</a>

Or to use FontAwesome:

<i class="opui-fa opui-anchor"></i>

Installation

To install the package you need to run the following command:

npm install optimizepress-ui

WordPress

To use the package inside an OptimizePress plugin, the best way is to use Laravel Mix and the sass-loader. So your webpack.mix.js should contain this:

let mix = require('laravel-mix');
mix.sass('resources/scss/app.scss', 'public/assets/css')
mix.js(['resources/js/app.js'], 'public/assets/js')

Inside your app.scss you simply need to include the UI like this:

$opui-wrapper: '#wpbody';
@import '~optimizepress-ui/src/scss/ui';

The $opui-wrapper is required because WordPress loads some style of its own, and to keep everything consistent we need to wrap all the classes.

Build

Building is required only if you want to contribute to the package. Otherwise, just use the package as described in the WordPress section.

To build all you required assets inside the package you need to run:

npm run dev

Or:

npm run watch

Keep in mind that upon running the command the first time, you will most likely get an error message regarding the sass loader. This is due to the fact that Laravel Mix requires different versions of the loader depending on your node.js version, so the correct version will be installed when running the command for the first time.

After that you simply need to run the command one more time, and it should all be good.

Scripts

The only script included for now is toggling the fullscreen mode in WordPress plugins. This is achieved by toggling a body class. An example on how to use the script can be found in the tests directory:

import {toggleFullscreen} from "../js/fullscreen";

document.addEventListener("DOMContentLoaded", function() {
    document.querySelector('.opui-fullscreen-btn').addEventListener('click', function (event) {
        event.preventDefault();
        toggleFullscreen('https://jsonplaceholder.typicode.com/posts/1');
    }, false);
});

The function accepts an attribute for an API endpoint URL. This endpoint should be used to store the current fullscreen state.

Preview

You can preview all components here: Preview UI Components

Contributing

To contribute to the package, simply clone the repository, make you changes, build the assets, and make a pull request.

Ideally you need to visit the test screens and watch if something is broken before sending the PR.