https://github.com/coveooss/visualforce-html-webpack-plugin
A Webpack plugin to generate HTML file from Salesforce Visualforce page
https://github.com/coveooss/visualforce-html-webpack-plugin
salesforce salesforce-visualforce-page visualforce-page webpack-plugin
Last synced: about 1 year ago
JSON representation
A Webpack plugin to generate HTML file from Salesforce Visualforce page
- Host: GitHub
- URL: https://github.com/coveooss/visualforce-html-webpack-plugin
- Owner: coveooss
- Created: 2017-08-09T14:21:00.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-06-28T14:32:20.000Z (almost 2 years ago)
- Last Synced: 2024-08-28T15:03:13.116Z (almost 2 years ago)
- Topics: salesforce, salesforce-visualforce-page, visualforce-page, webpack-plugin
- Language: HTML
- Size: 312 KB
- Stars: 3
- Watchers: 8
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Visualforce Webpack Plugin [](https://travis-ci.org/coveo/visualforce-html-webpack-plugin)
A Webpack plugin to generate HTML file from Salesforce Visualforce pages. This is especially usefull to locally develop Visualforce pages without having to deploy to Salesforce.
# Installation
Install the plugin with npm:
```
npm install --save-dev visualforce-html-webpack-plugin
```
# Basic usage
The plugin will generate an HTML file for you for each Visualforce pages present in your workspace.
Just add the plugin to your webpack config as follows:
```javascript
var VisualforceHtmlPlugin = require('visualforce-html-webpack-plugin');
var webpackConfig = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [new VisualforceHtmlPlugin(/* config */)]
};
```
# Configuration
Since Visualforce pages can have multiple references to your Salesforce organization, it is possible to "mock" most of them using the VisualforceHtmlPlugin configuration file
```javascript
var config = {
SalesforceContext: {
CustomModifiers: {
'':
`
`
},
Resources: {
jquery: "jquery/dist/"
},
Controllers: {
MyController: {
foo: "bar",
fooFile: { file: "bar.json" }
}
}
}
};
```
This configuration will resolve `$Resource.jquery` and `{!foo}` in your pages allowing you to use the same `` and `` imports you would in Salesforce.
The CustomModifiers option allow to specify a regex to match a resource in your Visualforce page, and the content with which to replace it.