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

https://github.com/ydah/slim-embedded-minify

A slim file to minify embedded code.
https://github.com/ydah/slim-embedded-minify

gem minify plugin ruby slim

Last synced: 6 months ago
JSON representation

A slim file to minify embedded code.

Awesome Lists containing this project

README

          

# SlimEmbeddedMinify

[![Gem Version](https://badge.fury.io/rb/slim-embedded-minify.svg)](https://badge.fury.io/rb/slim-embedded-minify)
[![test](https://github.com/ydah/slim-embedded-minify/actions/workflows/minitest.yml/badge.svg)](https://github.com/ydah/slim-embedded-minify/actions/workflows/minitest.yml)
[![RubyDoc](https://img.shields.io/badge/%F0%9F%93%9ARubyDoc-documentation-informational.svg)](https://www.rubydoc.info/gems/slim-embedded-minify)

A slim file to minify embedded code.

## Overview

Remove comments and unnecessary blank lines in the [css or javascript embedding](https://github.com/slim-template/slim#embedded-engines-markdown-) of your Slim files when embedding them in HTML.

### Example

You have a Slim file like this:

```slim
html
head
title My Slim Template
body
h1 Welcome to Slim!
css:
/* Slim supports embedded css */

body { background-color: #ddd; }
javascript:
// Slim supports embedded javascript
alert('Slim supports embedded javascript!')
```

If this gem is not applied, the HTML will look like the following:

```html


My Slim Template



Welcome to Slim!



/* Slim supports embedded css */

body { background-color: #ddd; }


// Slim supports embedded javascript
alert('Slim supports embedded javascript!')

```

Applying this gem will remove unnecessary blank lines and comments:

```html


My Slim Template



Welcome to Slim!



body { background-color: #ddd; }


alert('Slim supports embedded javascript!')

```

## Installation

Add this line to your application's Gemfile:

```ruby
# Gemfile
gem 'slim'
gem 'slim-embedded-minify'
```

And then execute:

```
bundle install
```

## Usage

All you have to do is add this gem to your Gemfile.
No additional configuration or changes to your code are required.

```ruby
# Gemfile
gem 'slim'
gem 'slim-embedded-minify'
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ydah/slim-embedded-minify. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ydah/slim-embedded-minify/blob/main/CODE_OF_CONDUCT.md).

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Slim::Embedded::Minify project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ydah/slim-embedded-minify/blob/main/CODE_OF_CONDUCT.md).