
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
yaml-js-loader
Advanced tools
Tells webpack how to load YAML files.
Open up your terminal and type the following
$ npm install --save-dev yaml-js-loader
The usage is quite easy.
Create a yaml file.
name: Izuku Midoriya
quirk: One for all
friends:
- Todoroki
- Lida
- Ochacho
- Bakugo
import the YAML file in your javascript file.
import config from './config.yml';
console.log(config);
// output -> {
// url: "",
// json: {
// name: "Izuku Midoriya",
// . quirk: "One for all",
// friends: [
// "Todoroki",
// "Lida",
// "Ochacho",
// "Bakugo"
// ]
// .},
// text:"name: Izuku Midoriya\nquirk: One for all\nfriends:\n - Todoroki\n - Lida\n - Ochacho\n - Bakugo"\n
//}
Add the following configuration to webpack config file.
...
{
test: /\.yml$/,
loader: 'yaml-js-loader'
}
...
Using with file loader provides a live URL to where the YAML file is served.
The file can be accessed by visiting [base_url][webpack_public_path][url]
for example,
if,
then,
to access the file in the browser, you would need to visit: http://localhost:3005/public/static/config.d23e812af.yml
Create a yaml file.
name: Izuku Midoriya
quirk: One for all
friends:
- Todoroki
- Lida
- Ochacho
- Bakugo
import the YAML file in your javascript file. Now, the url property should have a value.
import config from './config.yml';
console.log(config);
// output -> {
// url: "/static/[name].[hash:8].[ext]",
// json: {
// name: "Izuku Midoriya",
// . quirk: "One for all",
// friends: [
// "Todoroki",
// "Lida",
// "Ochacho",
// "Bakugo"
// ]
// .},
// text:"name: Izuku Midoriya\nquirk: One for all\nfriends:\n - Todoroki\n - Lida\n - Ochacho\n - Bakugo"\n
//}
Add the following configuration to webpack config file.
module.exports = {
...
{
test: /\.(yml|yaml)$/,
use: [
{ loader: 'yaml-js-loader' },
{
loader: 'file-loader',
options: {
name: 'static/[name].[hash:8].[ext]'
}
}
]
}
...
}
FAQs
A YAML file loader for webpack
The npm package yaml-js-loader receives a total of 242 weekly downloads. As such, yaml-js-loader popularity was classified as not popular.
We found that yaml-js-loader 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.