Wrong purge config
See original GitHub issueI’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Current behavior
Angular (not NX) tailwind config purge config:
purge: {
enabled: isProd,
content: [
'**/*.{html,ts}',
]
},
Expected behavior
purge: {
enabled: isProd,
content: [
'src/**/*.{html,ts}',
]
},
Minimal reproduction of the problem with instructions
ng add @ngneat/tailwind
not in NX project (I didn’t check NX project, but I assume it should work there)
What is the motivation / use case for changing the behavior?
Purge shouldn’t analyze other folders then src
or libs
.
Guess schematics can use angular.json
projects.[name].sourceRoot
.
See angular.json
for app with library:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"tailwind-ng11-t2": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"outputPath": "dist/tailwind-ng11-t2",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": [],
"customWebpackConfig": {
"path": "webpack.config.js"
}
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"browserTarget": "tailwind-ng11-t2:build"
},
"configurations": {
"production": {
"browserTarget": "tailwind-ng11-t2:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "tailwind-ng11-t2:build"
}
},
"test": {
"builder": "@angular-builders/custom-webpack:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": [],
"customWebpackConfig": {
"path": "webpack.config.js"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "tailwind-ng11-t2:serve"
},
"configurations": {
"production": {
"devServerTarget": "tailwind-ng11-t2:serve:production"
}
}
}
}
},
"testinglib": {
"projectType": "library",
"root": "projects/testinglib",
"sourceRoot": "projects/testinglib/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/testinglib/tsconfig.lib.json",
"project": "projects/testinglib/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/testinglib/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/testinglib/src/test.ts",
"tsConfig": "projects/testinglib/tsconfig.spec.json",
"karmaConfig": "projects/testinglib/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/testinglib/tsconfig.lib.json",
"projects/testinglib/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "tailwind-ng11-t2"
}
Maybe to check if there is a library in setup time and ask if to add it to purge?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
Config mismatch during import/export [#2922493] | Drupal.org
I'm seeing some unexpected behavior with purge config. I enabled acquia_purge module via Drush, configured purge stuff lightly, exported all ...
Read more >Remove Unnecessary Configuration Files On Debian
This brief tutorial explains different ways to remove unnecessary configuration files on Debian-based operating systems.
Read more >apt-purge is not removing configuration files. Why? : r/Ubuntu
Basically it's because they were not part of the install - purge undoes the install process completely, but user config files are typically ......
Read more >[SOLVED] purging residual config files - LinuxQuestions.org
After removing a large amount of installed software using Synaptic, I have many residual confugrations left over.
Read more >Finding and Purging Unpurged Packages on Ubuntu
When you purge a package (such as sudo apt purge php5.5-cgi ), all the package files, including modified configuration files, are deleted. After...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Close with https://github.com/ngneat/tailwind/commit/92bb0099492f68afc984dd1a93dfb3bb91a78a21 Using
project.sourceRoot
and default tosrc
if it’s undefined. If the consumers customize their source roots or want to add there libs directory topurge
(in AngularCLI project), then they would have to adjust the config themselves.Let’s stick with
sourceRoot
. Purge config can be (and should be) adjusted as the consumers see fit and we already state that in the README. Feel free to open a PR for this if you have time 😃