Skip to content

Commit 825bcee

Browse files
committed
actually passing through the path for naming
1 parent 932c4c0 commit 825bcee

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

src/file-system-loader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Core from './index.js'
22
import fs from 'fs'
3+
import _path from 'path'
34

45
export default class FileSystemLoader {
56
constructor() {
@@ -11,7 +12,7 @@ export default class FileSystemLoader {
1112
return new Promise( ( resolve, reject ) => {
1213
fs.readFile( path, "utf-8", ( err, source ) => {
1314
if ( err ) reject( err )
14-
Core.load( source, this.fetch.bind( this ) ).then( ( { injectableSource, exportTokens } ) => {
15+
Core.load( source, "/" + _path.relative(__filename, path), this.fetch.bind( this ) ).then( ( { injectableSource, exportTokens } ) => {
1516
this.sources.push( injectableSource )
1617
resolve( exportTokens )
1718
}, reject )

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ export default {
1818
scope
1919
],
2020

21-
load( sourceString, pathFetcher ) {
21+
load( sourceString, sourcePath, pathFetcher ) {
2222
let parser = new Parser( pathFetcher )
2323

2424
return postcss( this.plugins.concat( [parser.plugin] ) )
25-
.process( sourceString )
25+
.process( sourceString, { from: sourcePath } )
2626
.then( result => {
27-
return Promise.resolve({ injectableSource: result.css, exportTokens: parser.exportTokens })
27+
return Promise.resolve( { injectableSource: result.css, exportTokens: parser.exportTokens } )
2828
} )
2929
}
3030
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

2-
._input_css_1__one {
2+
._test_test_cases_localise_export_source__one {
33
color: red;
44
}
5-
._input_css_1__two {
5+
._test_test_cases_localise_export_source__two {
66
color: green;
77
}
8-
._input_css_1__three {
8+
._test_test_cases_localise_export_source__three {
99
color: blue;
1010
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"one": "_input_css_1__one",
3-
"two": "_input_css_1__two",
4-
"three": "_input_css_1__three"
2+
"one": "_test_test_cases_localise_export_source__one",
3+
"two": "_test_test_cases_localise_export_source__two",
4+
"three": "_test_test_cases_localise_export_source__three"
55
}

0 commit comments

Comments
 (0)