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

gulp-css-format-oneline

v1.2.0

Published

user gulp to compress <style> for html or compress css files

Downloads

8

Readme

gulp-css-format-oneline

gulp plugin for format multi lines css rule to oneline.

this can use for html\ejs files which has style tag, to compress style to oneline, also can use for .css file.

see examples for more info:

install

  1. npm install gulp;
  2. npm install gulp-css-format-oneline;

config(default)

const gulp = require('gulp')
const compressCss = require('gulp-css-format-oneline')
gulp.src('style.css')
  .pipe(compressCss({
    // is keep line end for each rule
    // see example
    clearLine: true,
    // is clear comment
    clearComment: true,
    // is merge multi `style` tags to one
    // for not .css files
    merge: false,
    // only string type
    // for other file ext which the plugin not include
    // default support .htm, .html, .ejs, .ftl, .css
    ext: null
  }))
  .pipe(gulp.dest(...))

example

default

gulpfile

const gulp = require('gulp')
const compressCss = require('gulp-css-format-oneline')
gulp.src('style.css')
  .pipe(compressCss())
  .pipe(gulp.dest(...))

origin style.css

/***
comment
***/
.a {
  display: block;
}

.b {
  display: block;
}

result

.a{display: block;}.b{display: block;}

one rule one line

gulpfile

const gulp = require('gulp')
const compressCss = require('gulp-css-format-oneline')
gulp.src('style.css')
  .pipe(compressCss({
    clearLine: false
  }))
  .pipe(gulp.dest(...))

origin style.css

/***
comment
***/
.a {
  display: block;
}

.b {
  display: block;
}

result

.a {display: block;}
.b {display: block;}

merge two or more tags to one

gulpfile

const gulp = require('gulp')
const compressCss = require('gulp-css-format-oneline')
gulp.src('style.css')
  .pipe(compressCss({
    merge: true
  }))
  .pipe(gulp.dest(...))

origin test.html

<style>
/***
comment
***/
.a {
  display: block;
}

.b {
  display: block;
}
</style>

<style>
.c {
  display: block;
}
</style>

result

<style>
.a{display:block;}.b{display:block;}.c{display:block;}
</style>

test

run:

npm i jest -g
jest