Set Aliases-local.ini path via API and merge it with default aliases #51

Closed
mellors opened this Issue Sep 13, 2013 · 1 comment

Comments

Projects
None yet
2 participants

mellors commented Sep 13, 2013

It would be helpful, if I could set one or more aliases files via a method and they would be merged with the core aliases (not replaced). Advantages:

  • Users could save the aliases in their common config directory.
  • Users could fetch the newest css-crush version with no need to check the changes inside of Aliases.ini

peteboere added a commit that referenced this issue Sep 14, 2013

Sepreated aliases file parsing into its own method `CssCrush::parseAl…
…iasesFile()` so merging with other alias files, or using external alias file is possible (issue #51).

Renamed the default boilerplate file to use a conventional file extention.
Deprecated and removed the *-local.ini now there is a better ways of augmenting the default aliases.
Lowercased the Aliases.ini filename.
Moved the library location property `CssCrush::$config->location` to `CssCrush::$dir`
Owner

peteboere commented Sep 14, 2013

Hi,

I don't quite get the use case for merging aliases over the default aliases, but I've made some changes to make it at least possible (changes made on v2 branch which requires PHP 5.3):

use CssCrush\CssCrush;

// Point to a custom aliases file (before using any library functions).
CssCrush::$config->aliasesFile = 'custom-aliases.ini';

// Merge a custom aliases file with the default aliases.
$custom_aliases = CssCrush::parseAliasesFile('custom-aliases.ini'); // Array 
$default_aliases = CssCrush::parseAliasesFile(CssCrush::$config->aliasesFile); // Array
CssCrush::$config->aliases = your_custom_merge($custom_aliases, $default_aliases);

@peteboere peteboere closed this Oct 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment