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

ng-tailwindcss

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-tailwindcss - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

.github/workflows/pull_request.yml

41

index.js

@@ -18,4 +18,5 @@ #!/usr/bin/env node

.option('-p, --purge', 'run PurgeCSS with this build')
.option('-c, --config <config>', 'relative path to alternate ng-tailwind.js file')
.action((args) => {
build({ purgeFlag: args.purge })
build({ purgeFlag: args.purge, configPath: args.config })
})

@@ -27,4 +28,5 @@

.description('Watches Tailwind files and rebuilds on changes')
.action((cmd) => {
watch()
.option('-c, --config <config>', 'relative path to alternate ng-tailwind.js file')
.action((args) => {
watch({ configPath: args.config })
})

@@ -36,3 +38,3 @@

.description('Configure your tailwind setup using custom arguments or the default setup;\n\tRestart of development server required for changes to take effect')
.option('-c, --config <config>', 'relative path to tailwind config js file')
.option('-c, --config <config>', 'relative path to tailwind.config.js file')
.option('-s, --source <source>', 'relative path to css source file')

@@ -48,8 +50,25 @@ .option('-o, --output <output>', 'relative path to css output file (referenced in angular.json output array)')

}
const ngTwConfig = {}
if (args.config) ngTwConfig.configJS = path.normalize(path.resolve(args.config))
if (args.source) ngTwConfig.sourceCSS = path.normalize(path.resolve(args.source))
if (args.output) ngTwConfig.outputCSS = path.normalize(path.resolve(args.output))
if (args.hasOwnProperty('purge') || args.unsetPurge) ngTwConfig.purge = args.purge || false
if (args.sass) ngTwConfig.sass = args.sass || false
if (args.config) {
ngTwConfig.configJS = path.normalize(path.resolve(args.config))
}
if (args.source) {
ngTwConfig.sourceCSS = path.normalize(path.resolve(args.source))
}
if (args.output) {
ngTwConfig.outputCSS = path.normalize(path.resolve(args.output))
}
if ({}.hasOwnProperty.call(args, 'purge') || args.unsetPurge) {
ngTwConfig.purge = args.purge || false
}
if (args.sass) {
ngTwConfig.sass = args.sass || false
}
configure(ngTwConfig, args.default)

@@ -70,2 +89,3 @@ })

.description('Run PurgeCSS on your output file to eliminate unused CSS selectors')
.option('-c, --config <config>', 'relative path to alternate ng-tailwind.js file')
.option('-k, --keyframes', 'PurgeCSS will remove unused keyframes')

@@ -78,3 +98,4 @@ .option('-f, --fontface', 'PurgeCSS will remove unused fontfaces')

fontFace: args.fontFace,
rejected: args.rejected
rejected: args.rejected,
configPath: args.config
})

@@ -81,0 +102,0 @@ })

@@ -21,4 +21,7 @@ const exec = require('child_process').exec

module.exports = ({ purgeFlag }) => {
const ngTwFile = path.normalize(path.resolve(process.cwd(), 'ng-tailwind.js'))
module.exports = ({ purgeFlag, configPath }) => {
const ngTwFile = configPath
? path.normalize(path.resolve(process.cwd(), configPath))
: path.normalize(path.resolve(process.cwd(), 'ng-tailwind.js'))
const config = fs.existsSync(ngTwFile) && require(ngTwFile)

@@ -33,3 +36,3 @@

if (config.purge || purgeFlag) purge({})
if (config.purge || purgeFlag) purge({ configPath })

@@ -40,3 +43,3 @@ return resolve(sourceFile)

const sassBuild = () => new Promise((resolve, reject) => sass.render({
const sassBuild = (configPath) => new Promise((resolve, reject) => sass.render({
file: config.sourceCSS

@@ -46,3 +49,5 @@ }, (err, result) => {

const tempFile = path.normalize(path.resolve(process.cwd(), 'temporary-tailwind-css-file.css'))
const tempFile = configPath
? path.normalize(path.resolve(process.cwd(), configPath.replace(/([\w\-.]+[-.][\w\-.]+\.(\w+))/, 'temporary-tailwind-css-file.css'))) // puts temp file in same dir as config file
: path.normalize(path.resolve(process.cwd(), 'temporary-tailwind-css-file.css'))

@@ -52,3 +57,7 @@ fs.writeFile(tempFile, result.css, err => err ? reject(err) : console.info('Sass Compiled.') || resolve(tempFile))

const removeFile = (file) => fs.unlink(file, err => err && console.error(err))
const removeFile = (file) => {
if (fs.existsSync(file)) {
fs.unlink(file, err => err && console.error(err))
}
}

@@ -58,3 +67,3 @@ if (config) {

sass
? sassBuild().then(twBuild).then(removeFile).catch(err => err && console.error(err))
? sassBuild(configPath).then(twBuild).then(removeFile).catch(err => err && console.error(err))
: console.log('No sass compiler installed. Run `npm i -O node-sass` or `npm i -O sass` and try again.')

@@ -61,0 +70,0 @@ } else {

@@ -5,4 +5,6 @@ const Purgecss = require('purgecss')

module.exports = ({ keyframes, fontFace, rejected }) => {
const ngTwFile = path.normalize(path.resolve(process.cwd(), 'ng-tailwind.js'))
module.exports = ({ keyframes, fontFace, rejected, configPath }) => {
const ngTwFile = configPath
? path.normalize(path.resolve(process.cwd(), configPath))
: path.normalize(path.resolve(process.cwd(), 'ng-tailwind.js'))

@@ -9,0 +11,0 @@ if (fs.existsSync(ngTwFile)) {

@@ -6,4 +6,6 @@ const chokidar = require('chokidar')

module.exports = () => {
const ngTwFile = path.normalize(path.resolve(process.cwd(), 'ng-tailwind.js'))
module.exports = ({ configPath }) => {
const ngTwFile = configPath
? path.normalize(path.resolve(process.cwd(), configPath))
: path.normalize(path.resolve(process.cwd(), 'ng-tailwind.js'))

@@ -18,3 +20,3 @@ if (fs.existsSync(ngTwFile)) {

build({})
build({ configPath })
})

@@ -29,3 +31,3 @@

build({})
build({ configPath })
})

@@ -32,0 +34,0 @@

{
"name": "ng-tailwindcss",
"version": "2.1.1",
"version": "2.2.0",
"preferGlobal": true,

@@ -11,3 +11,5 @@ "bin": {

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "standard && echo 'All tests pass!'",
"lint": "standard",
"lint:fix": "standard --fix"
},

@@ -33,7 +35,10 @@ "repository": {

"dependencies": {
"chokidar": "^3.0.0",
"commander": "^3.0.0",
"purgecss": "^1.3.0",
"update-notifier": "^3.0.0"
"chokidar": "^3.3.1",
"commander": "^4.1.1",
"purgecss": "^1.4.2",
"update-notifier": "^4.1.0"
},
"devDependencies": {
"standard": "^14.3.1"
}
}

@@ -6,7 +6,9 @@ # ng-tailwindcss

>
> - PurgeCSS, ready to rock "out of the box", but also fully configurable (and monorepo friendly)
> - PurgeCSS, ready to rock "out of the box", but also fully configurable
>
> - Sass support with optional dependency on node-sass
> - Sass support with optional dependency on [node-sass](https://www.npmjs.com/package/node-sass) or [dart-sass](https://www.npmjs.com/package/sass)
>
> - Defaults reflect Tailwind 1.0.0-stable file naming conventions (v2.0.0)
> - Defaults reflect Tailwind 1.0.0-stable file naming conventions (ngtw v2.0.0+)
>
> - Angular Workspaces (and other monorepo structures) Support (ngtw v2.2.0+)

@@ -286,3 +288,3 @@ ## Why Is This Necessary?

### _A Note About Monorepos_
### Monorepo Support

@@ -299,2 +301,13 @@ If you are working with a monorepo structure where the content you need PurgeCSS to examine is not necessarily in the `./src/` directory, you can use the `content` property to define the path to those directories.

If you have sub-projects that require fine-tuning of your ng-tailwind.js options, then you can create alternate ng-tailwind.js files for those sub-projects and leverage them in your watch/build/purge commands with the option `--config (-c)`. For example, your package.json scripts might look like this:
```js
{
"start": "ng serve & ngtw watch", // serves up "main app" using the default ./ng-tailwind.js for configuration
"start:other": "ng serve other & ngtw watch -c projects/other-app/other-ng-tailwind.js", // serves up sub-project in same monorepo with custom config file
"build": "ngtw build && ng build",
"build:other": "ngtw build other -c projects/other-app/other-ng-tailwind.js && ng build"
}
```
--------

@@ -365,2 +378,3 @@

--purge => -p
--config => -c

@@ -371,4 +385,6 @@ purge => p

--rejected => -r
--config => -c
watch => w
--config => -c
scripts => s

@@ -375,0 +391,0 @@

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