Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

partial-loader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

partial-loader

partial loader for webpack

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by11.11%
Maintainers
1
Weekly downloads
 
Created
Source

partial-loader

partial loader for webpack, transform your partial file with template

Install

npm install --save partial-loader

How to use

Add the loader to your webpack config, For example:

module.exports = {
  module: {
    rules: [
      {
        test: /\/src\/examples\/(?!index).*\.jsx?$/,
        use: [
          {
            loader: 'partial-loader',
            options: {
              templatePath: `${__dirname}/example-template.js`,
              placeholder: '/*** placeholder ***/',
            },
          },
        ],
      },
    ],
  },
}

Options

  • template - the content of template.
  • templatePath - absolute path of the template file, template will be ignored if provided.
  • placeholder - placeholder to be replaced, defaults to /*** placeholder ***/

Example

  1. template
import React from 'react'
import styled, { css } from 'styled-components'

/*** placeholder ***/
  1. code
const Button = styled.button`
  border-radius: 3px;
  padding: 0.25em 1em;
  margin: 0 1em;
  background: transparent;
  color: palevioletred;
  border: 2px solid palevioletred;
`;

export default Button
`
  1. transformed
import React from 'react'
import styled, { css } from 'styled-components'

const Button = styled.button`
  border-radius: 3px;
  padding: 0.25em 1em;
  margin: 0 1em;
  background: transparent;
  color: palevioletred;
  border: 2px solid palevioletred;
`

export default Button

FAQs

Package last updated on 02 Sep 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc