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

Miniparser

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Miniparser

  • 1.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Miniparser

Miniparser is a Ruby gem that takes code as input (HTML, JavaScript, or CSS), determines the code language, validates it, and then minifies it. It returns whether the code is valid or not, and if valid, provides the minified code.

Installation

Add this line to your application's Gemfile:

gem 'Miniparser'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install Miniparser

Usage

Miniparser provides two main methods to process either a file or a string containing HTML, JavaScript, or CSS code.

Processing a File

You can process a file by calling the type_file method and passing the file path as an argument:

result = Miniparser::Processor.type_file('path/to/yourfile.html')

Processing a String

You can process a string containing code by calling the type_string method:

result = Miniparser::Processor.type_string('<html><head></head><body></body></html>')

Both methods return a hash containing the validation status, any errors, and the minified code if the input was valid:

{
  valid: true or false,
  errors: "Error message if any",
  minified_code: "Minified code if valid"
}

Contributing

Bug reports and pull requests are welcome. Please adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 20 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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