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

manipulative

v0.1.1

Published

React devtool for modifying Emotion styles in browser

Downloads

2

Readme

manipulative

A React devtool for live-updating Emotion styles in the browser. When the styles look good, write them to your source files with one click.

manipulative demo

manipulative is currently alpha-quality software. If manipulative is not working for your use case, please file an issue and I'll try my best to help.

Requirements

Installation

npm install --dev manipulative
# or
yarn add --dev manipulative

Usage

Run server

The server writes changes to your source files.

npx manipulative-server

Invoke manipulative

Use one of these two approaches.

  1. useCssPlaceholder() - quickest but not ideal

If you have a create-react-app, you can use the Babel macro without any setup. Add calls to useCssPlaceholder() on elements you want to style.

import { useCssPlaceholder } from "manipulative/macro";

function MyComponent() {
  return (
    <div css={useCssPlaceholder()}>
      <p css={useCssPlaceholder()}>...</p>
    </div>
  );
}
  1. css__ prop

This more convenient approach requires a little Babel setup (see below).

// no need to import anything
function MyComponent() {
  return (
    <div css__>
      <p css__>...</p>
    </div>
  );
}

Modify and commit styles

In the browser, you should see the manipulative inspector with an input for each useCssPlaceholder() or css__ prop. Type CSS in the textarea to see styles update live. Click "commit" to write changes back to the source files, replacing useCssPlaceholder() and css__ props.

Be sure to remove any imports from manipulative when building for production!

Recommended Babel setup

If you want to use the more convenient css__ syntax, you'll need to install a Babel plugin that runs before React Fast Refresh.

If you have access to the Webpack config (e.g. you ejected CRA), add manipulative/babel to the list of Babel plugins. This plugin needs to run before react-refresh/babel.

{
  loader: 'babel-loader',
  plugins: [
    'manipulative/babel',
    'react-refresh/babel',
  ],
  ...
}

If you have not ejected CRA, you can still use this plugin with something like react-app-rewired. Here is an example config-overrides.js with react-app-rewired.

const { getBabelLoader } = require("customize-cra");

module.exports = function override(config) {
  getBabelLoader(config).options.plugins.unshift(
    require.resolve("manipulative/babel")
  );
  return config;
};

Known Limitations

  • manipulative only supports static styles. It does not handle functions or JS variables.
  • css__ cannot be used with css prop on the same element
    • css__ is transformed to css={...}. Therefore, one will override the other. There may be support for modifying existing styles in the future.