-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
33 lines (24 loc) · 841 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* CSScomb Loader for Webpack
* Copyright (c) 2015 Konstantin Tarkus <[email protected]>
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
'use strict';
var CssComb = require('csscomb');
var LoaderUtils = require('loader-utils');
var csscomb = new CssComb();
var config = CssComb.getCustomConfig() || CssComb.getConfig('csscomb');
csscomb.configure(config);
module.exports = function(source) {
if (this.cacheable) {
this.cacheable();
}
// TODO: Read the params and configure CSScomb
// var params = loaderUtils.parseQuery(this.query);
var file = LoaderUtils.getRemainingRequest(this);
var syntax = file.split('.').pop();
var processed = csscomb.processString(source, { syntax: syntax });
this.callback(null, processed);
};