1.0.8 • Published 7 years ago
webpack-php-output v1.0.8
PHP output from Webpack
Please note this module depends on webpack 2+.
This webpack plugin will create a PHP file in your outPutPath
directory with a PHP class in it having two static
attributes: $jsFiles
and $cssFiles
. These can be accessed by your PHP application to learn about what to include
when rendering the frontend of the site.
Note that the php manifest is created with (node fs)https://nodejs.org/api/fs.html independently of the Webpack output cycle. It will therefor be created in the same location when running a standard Webpack build or Webpack Dev Server
Install
With Yarn:
yarn add webpack-php-output
With NPM:
npm i webpack-php-output
Usage
// ...in your webpack config file
const PhpOutputPlugin = require('webpack-php-output');
module.exports = {
// ...
plugins: [
new PhpOutputPlugin(options)
]
}
options
options = {
devServer: false, // false or string with server entry point, e.g: app.js or
outPutPath: false, // false for default webpack path of pass string to specify
assetsPathPrefix: '',
phpClassName: 'WebpackBuiltFiles', //
phpFileName: 'WebpackBuiltFiles',
nameSpace: false, // false {nameSpace: 'name', use: ['string'] or empty property or don't pass "use" property}
path: ''
}