wesaynih / infrastructure

© 2016 The Knights Who Say NIH — Do NOT fork this repository without permission.
http://frameless.io/
Other
0 stars 1 forks source link

Find Gulp sources via media type instead of via file name extension #34

Closed Robbert closed 8 years ago

Robbert commented 8 years ago

As described in issue #33, where all JSON files need to be processed, looking for *.json is too naive. Instead there should be a registry of file extension mappings to media types, and a file pattern generator with media type as input.

An example that already is in this repository: frameless.sublime-project, which ends with .sublime-project and has a application/json media type.

The question is: where do we define these mappings? Currently a bunch of them is already defined in .htaccess... Should we parse the .htaccess file, or should we generate the .htaccess based on another definition file?

Robbert commented 8 years ago

Let's close all issues that are on the backburner, and reopen them when research & development becomes viable.

Robbert commented 8 years ago

Nice: obviously there is a npm package called mime-db that contains an incredible amount of media type descriptions. We could easiliy combine that with lovell's media-type to parse them and filter them to find all extensions associated with application/json and */*+json media types.

Robbert commented 8 years ago

Consider it done!

It would be nice if in the future, when possibly the *.jsm file extension is introduced for JavaScript modules, all linting will automatically work.

Robbert commented 8 years ago

One disadvantage is that now we're dependent on mime-db to stay accurate... when they remove mappings for *.js for example, it could result in publishing corrupted builds. It would be a good idea to introduce a basic test for the returned media types for the most essential media types: that is, every file extension used in this repository.