Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
knockout-template-loader
Advanced tools
This is a webpack loader that will load knockout templates from html files. When chained with the html loader, it utilizes the stringTemplateEngine by Ryan Niemeyer to load the html template and make it available to knockout's template parsing logic.
npm install knockout-template-loader --save-dev
Either add it to your global webpack.config.js
, chaining after the html-loader
:
{
module: {
loaders: [{
test: /\.html$/,
use: [{
loader: "knockout-template-loader",
options: {
name: "[name]",
caseInsensitive: true
}
},
{
loader: "html-loader"
}]
}]
}
}
or, if you don't want to use it globally, on a case-by-case basis:
require("knockout-template!html!./my-template-file.html");
name: string | function(string) => string
By default, the loader will make the template available to knockout using the template's file name. If you want to override that, you can specify the name
parameter.
[name]
for filename without extension.Examples
...
name: "[name]" // use file name without extension
name: function(fullname) {
// use parent directory name + filename
var directoryName = path.basename(path.dirname(fullname));
var filename = path.basename(fullname).replace(/\.[^/.]+$/, "");
return directoryName + "-" + filename;
}
...
Or using as an inline loader parameter:
require("knockout-template?name=myBetterName!html!./my-template-file.html");
caseInsensitive: boolean
(default: false
)If set to true
, the underlying template name resolution will happen case-insensitively, otherwise it will be case sensitive.
FAQs
Knockout html template loader for webpack
We found that knockout-template-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.