A lightweight library to perform integrity tests on your CakePHP asset_compress.ini file!
npm install node-asset-compress  
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!
asset_compress.ini. To do this, you will be using the link function defined in NodeAssetCompress.asset_compress.ini;``javascript
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.
`javascript
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.
`javascript`
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']
});single
The sections provided will be checked individually for internal conflicts () 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.`javascript`
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.