
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
webpack-blade-native-loader
Advanced tools
A webpack loader for blade template engine using Laravel's Illuminate/View component itself.
This loader passes on the contents of your blade views to a PHP script. The PHP script sets up a ViewFactory to render the blade code to HTML. This means that your views are rendered entirely using PHP. The resulting HTML is passed back into the Webpack flow.
As we're using PHP behind the scenes, you should have PHP available on your system. Please see the Laravel Docs for the minimal supported version.
Upon installing the loader, Illuminate/View is being pulled in using composer. To install composer on your system, please see getcomposer.org.
To begin, you'll need to install webpack-blade-native-loader
:
$ npm install webpack-blade-native-loader --save-dev
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.blade\.php$/,
use: [
{
loader: 'webpack-blade-native-loader',
options: {
viewDir: 'resources/views'
}
}
],
},
],
},
};
This loader works great combined with HtmlWebpackPlugin. Here's an example how to set that up.
webpack.config.js
const pages = glob.sync('**/*.blade.php', {
cwd: path.join(process.cwd(), `resources/views/`),
root: '/',
})
.map((page) => new HtmlWebpackPlugin({
filename: page.replace('.blade.php', '.html'),
template: `resources/views/${page}`,
}));
module.exports.plugins.push(...pages);
This will render all of the blade files in the resources/views directory to HTML. If you're using partials, this might not be what you want. The updated example below filters out any views that contain an underscore in their paths. You can specify your own rules by modifying the filter statement or add more to suit your needs.
webpack.config.js
const pages = glob.sync('**/*.blade.php', {
cwd: path.join(process.cwd(), `resources/views/`),
root: '/',
})
// Filter out views that contain an underscore in their paths
.filter(filename => filename.indexOf('_') === -1)
.map((page) => new HtmlWebpackPlugin({
filename: page.replace('.blade.php', '.html'),
template: `resources/views/${page}`,
}));
module.exports.plugins.push(...pages);
viewDir
Type: String
Default: ''
The path of the directory where template files are located.
The MIT License (MIT). Please see License File for more information.
This package is being maintained by Esign. We're a creative digital agency located in Ghent, Belgium.
FAQs
Webpack loader for Laravel's blade template engine.
The npm package webpack-blade-native-loader receives a total of 4 weekly downloads. As such, webpack-blade-native-loader popularity was classified as not popular.
We found that webpack-blade-native-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.