https://github.com/jsdf/css-modules-loader-core-sync
synchronous version of css-modules-loader-core
https://github.com/jsdf/css-modules-loader-core-sync
Last synced: about 2 months ago
JSON representation
synchronous version of css-modules-loader-core
- Host: GitHub
- URL: https://github.com/jsdf/css-modules-loader-core-sync
- Owner: jsdf
- Created: 2015-10-27T01:20:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-27T01:25:44.000Z (over 9 years ago)
- Last Synced: 2025-03-06T06:40:46.217Z (about 2 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# css-modules-loader-core-sync
synchronous version of css-modules-loader-coreAPI is the same as css-modules-loader-core except that methods return values rather than promises of values.
### example
```js
var fs = require('fs');
var path = require('path');
var resolve = require('resolve');
var SyncCore = require('css-modules-loader-core-sync');function pathFetcher(filepath, relativeTo) {
return resolve.sync(filepath.replace(/["']/g, ''), {basedir: path.dirname(relativeTo)});
}var syncCore = new SyncCore();
var filepath = __dirname + '/fixtures/a.css';
var src = fs.readFileSync(filepath, {encoding: 'utf8'});var result = syncCore.load(src, filepath, '', pathFetcher);
console.log(result.exportTokens); // => exported classes
console.log(result.injectableSource); // => compiled css
```