
Product
Introducing the Alert Details Page: A Better Way to Explore Alerts
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.
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!=prerenderedMarkup
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',
},
},
})
The rendered component will be available through grunt.config.get('template_engine.options.data.component')).
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.
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
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.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.