question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hello,

I just saw tailwind the other day and wanted to merge it with angular which lead me here.

I wanted to first try to purge the CSS before I start with the app, but the problem I faced was that there was no purge happening when building for production and angular would give me the following error.

> NODE_ENV=production & ng build --prod

'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
√ Browser application bundle generation complete.

Warning: budgets: initial exceeded maximum budget. Budget 500.00 kB was not met by 3.35 MB with a total of 3.84 MB.

Error: budgets: initial exceeded maximum budget. Budget 1.00 MB was not met by 2.84 MB with a total of 3.84 MB.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-tailwind-components@0.0.0 build:prod: `NODE_ENV=production & ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-tailwind-components@0.0.0 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Extra Info:

  • OS: Windows 10
  • Node: 14.15.0
  • Angular 11

I managed to solve this by doing the following:

Install dotenv

npm install dotenv -D

Update tailwind.config

require('dotenv').config();
const enablePurge = process.env.NODE_ENV || false;

module.exports = {
  purge: {
    enabled: enablePurge,
    content: [
      './src/**/*.html',
      './src/**/*.ts'
    ],
  },
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
};

Update package.json

add SET in build:prod script command

{
    ...
    "scripts": {
        ...    
        "build:prod": "SET NODE_ENV=production & ng build --prod"
    },
    ...
}

Result

> SET NODE_ENV=production & ng build --prod

√ Browser application bundle generation complete.
√ Copying assets complete.
√ Index html generation complete.

Initial Chunk Files               | Names         |      Size
main.f67b3d0dbce69012d3b2.js      | main          | 182.19 kB
polyfills.8c151b8375e767ff858f.js | polyfills     |  36.00 kB
styles.37982bb62c8e9ed08b5e.js    | styles        |  14.70 kB
runtime.39392f927e7c9fd727c8.js   | runtime       |   1.45 kB

                                  | Initial Total | 234.34 kB

Build at: 2020-12-19T20:06:20.841Z - Hash: 58b2ca811974ccd8d53e - Time: 13798ms

Note: I don’t know if this can be considered an issue or not, but I hope it helps anyone who faces the same problem.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
danielehrhardtcommented, Dec 26, 2020

@darkside-e thanks for reporting this issue on Windows. There might be a solution to use the package cross-env so that setting NODE_ENV=production works across platforms like Windows as well as on Mac and Linux.

Can you try if it works with the following script and cross-env deps?

{
  "scripts": {
     "build:prod": "cross-env NODE_ENV=production ng build --prod"
     ...
  },
  "devDependencies": {
    ...
    "cross-env": "^7.0.3",
  }
}

@stuartkuentzel yes enabling purge by default also effects ng serve. Can you give it a try with the above approach?

It does work.

1reaction
danielehrhardtcommented, Jan 8, 2021

Should I include this in the schematics under a flag like --installCrossPlatform?

It should be a default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Groundwater Sampling - No-Purge/Passive - Enviro Wiki
No -purge sampling includes any method where no water is removed (i.e., purged) from the well prior to sample collection. The sample itself...
Read more >
NO-PURGE GROUNDWATER SAMPLING
No -Purge sampling involves collecting a sample, typically by carefully lowering a bailer to the water table and allowing it to fill with...
Read more >
No Purge - Album by Dante Terrell | Spotify
No Purge. Dante Terrell. 202111 songs, 33 min 57 sec. 1. Best Kept SecretDante Terrell. 2. Cookin'Dante Terrell. 3. Weld TalkDante Terrell.
Read more >
Passive (no purge) Samplers - CLU-IN
Passive sampling can be defined in the broadest sense as any method based on the free flow of contaminant molecules from the sampled...
Read more >
Non-Purge Sampling Option at Petroleum Sites - IN.gov
When these wells were removed from the data set, there was no difference in purged and non- purged samples at a 90% confidence...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found