
Product
Introducing Immutable Scans
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.
grunt-react-renderize
Advanced tools
Render React components into Grunt config.
This plugin requires Grunt.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-react-renderize --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-react-renderize');
This plugin allows you to render a React component from file into Grunt config. This value can be then used with a template engine of your choosing, that allows providing data to templates through the config. For example let's assume you have a React module:
var React = require('react');
module.exports = React.createElement('p', null, 'I need this in my template.');
and a Jade template:
div!=prerenderedBody
The result, after providing 'jade.options.data.prerenderedMarkup' as a destination for the task, would be:
<div><p>I need this in my template.</p></div>
I wanted to prerender the React components and reuse them in Jade templates. This gives me the freedom to apply any filter to the rendered markup. The only way I knew to do this was by setting the Grunt config. Thus the plugin was born.
If you know of a better way to solve this problem, please contact me :)
Type: String
Default value: empty string
Used as a separator when joining multiple rendered components.
This should render the component from a file into Grunt config.
grunt.initConfig({
react_renderize: {
files: {
'template_engine.options.data.component': 'components/my_component.js',
},
},
})
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2014 FatFisz. Licensed under the MIT license.
FAQs
Render React components into Grunt config or files.
The npm package grunt-react-renderize receives a total of 3 weekly downloads. As such, grunt-react-renderize popularity was classified as not popular.
We found that grunt-react-renderize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.