Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/benbowes/singleline

Convert a multiline string into a single line string, concatenate class-names, minimize html
https://github.com/benbowes/singleline

string-manipulation

Last synced: 6 days ago
JSON representation

Convert a multiline string into a single line string, concatenate class-names, minimize html

Awesome Lists containing this project

README

        

# singleline

![Build status](https://api.travis-ci.org/benbowes/singleline.svg?branch=master)

Convert a multiline string to a single line string
---

## Getting started

Install the dependency

`npm install singleline --save-dev`

## React classNames example

```js
import singleline from 'singleline';

...


Some output

// className="rrs__select-container rrs__select-container--multiselect rrs__is-desktop rrs__options-container--visible"
```

## Example 2

Passing second parameter in as `true`, removes spaces around the HTML tags but it still respects the spaces in the contents of the tags and attributes.

```js
import singleline from 'singleline';
var testMultilineHTMLString = singleline(`






GDD - Giphy Github embed Gif code explorer






`, true);

console.log(testMultilineHTMLString);

// 'GDD - Giphy Github embed Gif code explorer

'

```