Giter VIP home page Giter VIP logo

react-cap's Introduction

react-cap

A fork of react-helmet

its react-helmet, with the data-react-helmet attribute removed

  • No longer uses data-react-helmet attributes
  • Assumes all HTML metadata is assigned using this package
  • To prevent react-cap from removing metadata assigned not using react-cap:
    • apply attribute data-ignore-metadata to an html element to prevent it being removed
    • apply attribute data-ignore-metadata="attrName,attrName" to an html element to prevent modification of specific attributes

This package was originally created to support using HTML <head> metadata with the react v16 streaming interface. See react-html-metadata for an implementation that supports react server side streaming.

Install

NPM
npm install --save react-cap
Yarn
yarn add react-cap

Usage

import Helmet from 'react-cap';

For more documentation, see react-helmet documentation Usage is exactly the same as react-helmet.

Usage with webpack style-loader

To prevent the webpack <style> tags from being removed, you must configure the style-loader with an ignore attribute.

{
  test: /\.css$/,
  use: [
    { loader: 'style-loader', options: { attrs: { data-ignore-metadata: true } } }
  ]
}

Usage with webpack css-loader

Its recommended you utilize asset files to apply css stylesheets using react-cap

License

MIT

react-cap's People

Contributors

adam-26 avatar andykenward avatar apalchys avatar artazor avatar athomann avatar bryanrsmith avatar cesarandreu avatar cwelch5 avatar dattran92 avatar dhoward avatar doctyper avatar felixsanz avatar gaearon avatar hiroshi-cl avatar jamsea avatar jasonblanchard avatar jaysoo avatar jirutka avatar jmurzy avatar kaseyjcowley avatar katt avatar kesava avatar kulakowka avatar lourd avatar mull avatar neilius avatar nuc avatar potench avatar romanonthego avatar tmbtech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

apalchys

react-cap's Issues

Allow handleClientStateChange() to accept a diff

Allow handleClientStateChange() to accept a diff (or current and previous state) to be used to determine exactly what needs to be added/removed from the DOM (without needing to use the data-ignore-cap attribute).

Determine if this should continue to inspect the DOM to determine what to (or can be) remove(d), or rely solely on the input data.

Do no publish npm-shrinkwrap.json

Hi,

Thanks for the library!

Today I found out react-cap 5.3.2 contains npm-shrinkwrap.json and as result npm downloads all react-cap dev dependencies when we use it.
I suggest to exclude it from npm via .npmignore

https://docs.npmjs.com/files/shrinkwrap.json

It's strongly discouraged for library authors to publish this file, since that would prevent end users from having control over transitive dependency updates.

Rewrite Tests

As this fork only includes the react-helmet utilities, it would be better if all tests were written directly against the utility methods and not against the <Helmet > component.

If this is done, then all *AsString() utility methods can be removed as they are currently only required for testing. (Along with /test/Helmet.js, which facilitates tests using the original tests). This will also allow a few dev dependencies to be removed.

React 16 Bug?

Investigate:

When upgrading the react and react-dom dependencies to version 16.x, there are 2 tests that fail. Both to do with applying the attribute itemProp to a <title> tag.

It appears that R.16 no longer converts the itemProp attribute to lower-case.

To repeat this, simply update react dependency versions in package.json then run npm test.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.