npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-css-shrink

v0.0.5

Published

Angular post-processing to reduce css file size by filtering only relevant css classes

Downloads

193

Readme

A Post analysis script to automatically reduce the size of CSS for Angular App (should work with other frameworks too)

Table of contents

Prerequist

NodeJs > 12.19.0

  • Has been tested on Angular 10 and 11
  • Has been tested with bootstrap, ng-bootstrap, boosted, ng*boosted, angular material

Extra js and css file used in your angular project should be declared in your angular json file to be in the compiler scope. Css files declared in index.html are not taken into account

angular.json

           ...
           "styles": [
              "./src/styles.scss",
              "node_modules/boosted/scss/boosted.scss",
              "./icons/retailers-v1.0/style.css",
              "node_modules/boosted/dist/css/orangeHelvetica.css",
              "node_modules/ng-boosted/style/ng-boosted.scss"
            ],
            "scripts": []
            ...

Installation

step 1 : install the plugin

npm install -d angular-css-shrink

Step 2 : create a webpack config file at the root of your project (or update )

extra-webpack.config.js :

var AngularCssShrink = require('angular-css-shrink');

module.exports = {
  plugins: [new AngularCssShrink({ debug: false })]
};

Step3 : Update your angular.json

To use extra webpack plugin use @angular-builders instead of @angular-devkit and add customWebpackConfig option to configure the webpack config js file

replace

"architect": {
        "build": {
            "builder": "@angular-devkit/build-angular:browser",
            "options": {
            "aot": true,
            "outputPath": "dist/myDummyProject",
            "index": "src/index.html",

with

"architect": {
    "build": {
          "builder": "@angular-builders/custom-webpack:browser",
           "options": {
            "customWebpackConfig": {
              "path": "./extra-webpack.config.js"
            },
            "aot": true,
            "outputPath": "dist/myDummyProject",
            "index": "src/index.html",

To run angular css shrink on ng serve

replace

     "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",

with

   "serve": {
          "builder": "@angular-builders/custom-webpack:dev-server",

Usage

run your regular ng serve or ng build command, css is now automatically shrinked

Copyright and license

Angular Css Shrink code and documentation copyright 2021 the Angular Css Shrink Authors and Orange SA. Code released under the MIT License.