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.
- Host: GitHub
- URL: https://github.com/ydah/slim-embedded-minify
- Owner: ydah
- License: mit
- Created: 2023-07-11T11:24:16.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-18T15:34:00.000Z (7 months ago)
- Last Synced: 2025-04-15T22:49:48.180Z (6 months ago)
- Topics: gem, minify, plugin, ruby, slim
- Language: Ruby
- Homepage: https://rubydoc.info/gems/slim-embedded-minify
- Size: 50.8 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# SlimEmbeddedMinify
[](https://badge.fury.io/rb/slim-embedded-minify)
[](https://github.com/ydah/slim-embedded-minify/actions/workflows/minitest.yml)
[](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).