{"_id":"react-asset-collector","_rev":"34-52e7c6e9b188a8c248505070feffcc20","name":"react-asset-collector","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"react-asset-collector","version":"1.0.0","keywords":["react","assets","http2","push"],"author":{"name":"Infinum","email":"support@infinum.co"},"license":"MIT","_id":"react-asset-collector@1.0.0","maintainers":[{"name":"darkokukovec","email":"darko@kukovec.eu"}],"contributors":[{"name":"Darko Kukovec","email":"darko@infinum.co"}],"homepage":"https://github.com/infinum/react-asset-collector#readme","bugs":{"url":"https://github.com/infinum/react-asset-collector/issues"},"dist":{"shasum":"bbf30f1154128f66fa33811a29716acb2018fba7","tarball":"https://registry.npmjs.org/react-asset-collector/-/react-asset-collector-1.0.0.tgz","integrity":"sha512-grMpz1xS29xUXx71lMLP4URNIBzQSP2nNWVgggG3vz27ev+yIxyq1Y5ym+Qy+Udl0MiJ6jvackpk5WbUQ8GtnA==","signatures":[{"sig":"MEUCIASip8vNfgCnd85oXarbAdHT/+wWOyJD6Ig2Q7itKfCqAiEA6+OL0LoCzf6t/3kbZcFSYmI7xycr4LbpoPPLzJ0QhIg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"bbf30f1154128f66fa33811a29716acb2018fba7","gitHead":"cd1e752676d633a3341cf57f0778e0c668d6921f","scripts":{"test":"mocha test.js","precommit":"npm test"},"_npmUser":{"name":"darkokukovec","email":"darko@kukovec.eu"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","repository":{"url":"git+https://github.com/infinum/react-asset-collector.git","type":"git"},"_npmVersion":"3.10.3","description":"Collect assets from react components so you can do HTTP2 push","directories":{},"_nodeVersion":"6.3.1","dependencies":{"lodash":"^4.14.1"},"devDependencies":{"chai":"^3.5.0","husky":"^0.11.6","mocha":"^3.0.1","react":"^15.3.0"},"peerDependencies":{"react":"^15.3.0"},"_npmOperationalInternal":{"tmp":"tmp/react-asset-collector-1.0.0.tgz_1470402117841_0.38779427483677864","host":"packages-16-east.internal.npmjs.com"}}},"time":{"created":"2016-08-05T13:01:59.550Z","modified":"2025-09-17T07:26:04.708Z","1.0.0":"2016-08-05T13:01:59.550Z"},"bugs":{"url":"https://github.com/infinum/react-asset-collector/issues"},"author":{"name":"Infinum","email":"support@infinum.co"},"license":"MIT","homepage":"https://github.com/infinum/react-asset-collector#readme","keywords":["react","assets","http2","push"],"repository":{"url":"git+https://github.com/infinum/react-asset-collector.git","type":"git"},"description":"Collect assets from react components so you can do HTTP2 push","contributors":[{"name":"Darko Kukovec","email":"darko@infinum.co"}],"maintainers":[{"email":"accounts.npm@infinum.com","name":"infinumcom"},{"email":"npm@kuk.is","name":"darkokukovec"},{"email":"filip.voska@gmail.com","name":"fvoska"},{"email":"mihael.safaric+npm@gmail.com","name":"safo6m"},{"email":"dani.pavic@infinum.com","name":"danipavic"},{"email":"ACcounts.npm@infinum.com","name":"infinumco"}],"readme":"# react-asset-collector\nCollect assets from react components so you can do HTTP2 push\n\n[![Build Status](https://travis-ci.org/infinum/react-asset-collector.svg?branch=master)](https://travis-ci.org/infinum/react-asset-collector)\n[![Dependency Status](https://david-dm.org/infinum/react-asset-collector.svg)](https://david-dm.org/infinum/react-asset-collector)\n[![devDependency Status](https://david-dm.org/infinum/react-asset-collector/dev-status.svg)](https://david-dm.org/infinum/react-asset-collector#info=devDependencies)\n\n## withAssets(css = [], files = [])\n* Receives two arguments: array of CSS modules and array of file paths\n* Returns a function which receives one argument: The component we want to decorate\n\n### Examples\n\nWith decorators (e.g. [transform-decorators-legacy](https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy) + webpack)\n\n    import {Component} from 'react';\n\n    import styles from 'styles.css';\n    import photo from 'photo.jpg';\n    import icon from 'icon.png';\n\n    @withAssets([styles], [photo, icon])\n    export default class MyComponent extends Component {}\n\nWithout decorators\n\n    const React = require('react');\n\n    class MyComponent extends Component {}\n    module.exports = withAssets([], ['photo.jpg', 'icon.png'])(MyComponent);\n\n## getAssets(components = [])\n* Receives list of components that will be rendered (e.g. from a react-router)\n* Returns an object with ``css`` (object with all used classes) and ``files`` (list of URL-s)\n\n### Examples\n\nWith react-router and SSR\n\n    match({location: req.url, routes: routes}, function(error, redirect, renderProps) {\n      const assets = getAssets(renderProps.components);\n\n      // Push assets to the client\n    });\n\n## Requirements\n* Should work on all versions of Node.js\n* Should work in all browsers (not sure if usefull there)\n* Dev requirement: Node.js 6.3+\n\n## TODO\n* Adding assets from inside of the class (e.g. in the render method)\n\n## License\n[MIT License](LICENSE)\n","readmeFilename":"README.md"}