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

@splice/angular-cli-wrapper

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@splice/angular-cli-wrapper

Splice wrapper for Angular CLI

  • 1.0.0-rc.4.1
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
3
Weekly downloads
 
Created
Source

Angular CLI Wrapper

Wraps Angular CLI in a loving stranglehold, and forces your Webpack config down its throat.

Installation

Install the package:

$ yarn add --dev @splice/angular-cli-wrapper

Initialize- this will create a default webpack-config.js file in your project root:

$ yarn run splice-ng init

Modify any scripts in your package.json that reference ng (eg. ng serve, ng build) with splice-ng (eg splice-ng serve, splice-ng build). [TODO: This step will one day part of init]

Usage

Angular CLI Wrapper lets you use on-disk paths in the src attribute of img tags (and any other attributes of other tags that you configure in webpack-config.js). This means that references to images will be fingerprinted, and they'll respect the deployUrl setting instead of being relative to /.

Since the entire Webpack config is now available, you can feel free to modify it as needed for your particular application. Do be careful though- you don't want to do anything too crazy and run the risk of causing problems with Angular CLI.

How it works

Angular CLI Wrapper uses some Node Magic™ to hook into the module loading process and intercept the Angular CLI code responsible for loading Webpack configs. After the default config loading code runs, the entire configuration, along with the project's current build settings, are passed off to code in your application, providing you the opportunity to modify the Webpack config before the project is built.

The splice-ng init command generates a default webpack-config.js file that contains one function, taking the existing config and build options, and returning a new config:

const merge = require('webpack-merge');

module.exports = function (originalConfig, buildOptions) {
  let newConfig = merge.smart(originalConfig, {
    module: {
      rules: [
        { test: /\.html$/, loader: 'html-loader?-minimize&interpolate&attrs=img:src video:poster source:src' }
      ]
    }
  });

  return newConfig;
}

The webpack-merge package is used which allows easy merging of Webpack configs without having to worry about unintentonally overwriting existing rules and settings.

FAQs

Package last updated on 24 Mar 2017

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