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

node-asset-compress

v1.0.1

Published

A lightweight library to perform integrity tests on your CakePHP asset_compress.ini file!

Downloads

29

Readme

Travis-CI Code Climate Test Coverage

Node Asset Compress

This library is not intended to be used without a task runner such as Grunt or Gulp, but can certainly be used if you so desire. If you use Grunt, you can use the grunt-asset-compress package instead.

As your configuration file grows, it becomes harder and harder to assert the integrity of the file. To conquer this, we developed this simple package based on node-file-parser to perform multiple checks on your asset_compress.ini.

Automatic fixing is supported for simple conflicts, and is completely optional. Likewise, you can also choose to clean up your configuration file with this library quite easily!

Table of contents

Getting Started

The first step is to make the library aware of the location of your asset_compress.ini. To do this, you will be using the link function defined in NodeAssetCompress.

  • The filename must be an exact match of asset_compress.ini;
  • The file is not read (or written to) instantly, and thus the link can be made at any point of execution.
var NodeAssetCompress = require('node-asset-compress');

var file_url = './foo/asset_compress.ini';
var file = NodeAssetCompress.link(file_url);

You can then choose to either check the file for issues, or to clean the file. In this case, we're going to clean the file first.

  • Cleaning the file removes all comments, empty lines and unneeded whitespace;
  • Cleaning the file is not mandatory for the issue checking to work, it is just for aesthetics.
var NodeAssetCompress = require('node-asset-compress');

var file_url = './foo/asset_compress.ini';
var file = NodeAssetCompress.link(file_url).clean();

Now is the time to perform tests on the file, note that there's a lot of ways to enter data and there's even more data coming back. For exact implementation details please refer to the documentation.

var result = file.check({
    'domain.com/': ['default.js', 'events.js', 'puppies.js'],
    'domain.com/calendar': ['calendar.js', 'events.js'],
    'domain.com/something': ['default.js', 'calendar.js', 'puppies.js']
});

The sections provided will be checked individually for internal conflicts (single) and will also be checked against each other (but only to the ones they are paired with) for conflicts as a group (multiple). The result can be inspected and further action can then be taken accordingly by fixing the file, or not.

file.fix({
    single: true,
    multiple: false
});

Contributing

Whether you're a programmer or not, all contributions are very welcome! You could add features, improve existing features or request new features. Assuming the unit tests cover all worst-case scenarios, you will not be able to report bugs because there will be no bugs.

If you want to make changes to the source, you should fork this repository and create a pull-request to our master branch. Make sure that each individual commit does not break the functionality, and contains new unit tests for the changes you make.

To test your changes locally, run npm install followed by npm test. All files that you added or changed must have score 100% coverage in its statements, branches, functions and lines. You will also have to sign the Contributor License Agreement, which will take a minute of your time but ensures that neither of us will sue the other.

Versioning

As much as we want everyone to always use the latest version, we know that this is a utopia. Therefore, we adhere to a strict versioning system that is widely accepted: major.minor.patch. This is also known as the SemVer method.