Skip to content

Conversation

joshwnj
Copy link
Member

@joshwnj joshwnj commented Jul 4, 2017

Fixes #74 (hopefully)

@Nimelrian
Copy link

Nimelrian commented Jul 4, 2017

Does not work on Windows with the following setup:

└───css-modulesify-test
      ├───border.css
      ├───gulpfile.js
      ├───index.js
      ├───package.json
      └───style.css

package.json

{
  "name": "css-modulesify-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "browserify": "^13.3.0",
    "css-modulesify": "css-modules/css-modulesify#fix-windows-abs-path",
    "gulp": "^3.9.1"
  }
}

gulpfile.js

const browserify = require('browserify');
const cssModules = require('css-modulesify');
const gulp = require('gulp');

gulp.task('default', () => {
  browserify({
    entries: './index.js',
    debug: true,
  })
    .plugin(cssModules, {
      output: './modules.css',
    })
    .bundle()
    .pipe(gulp.dest('./bundle.js'));
});

index.js

const styles = require('./style.css');

console.log(styles.normal);

style.css

.normal {
  composes: greyBottom from './border.css';
}

border.css

.greyBottom {
  border-bottom: 1px solid #C8C8C8;
}

Error message:

C:\dev\js\css-modulesify-test>gulp
[09:13:44] Using gulpfile C:\dev\js\css-modulesify-test\gulpfile.js
[09:13:44] Starting 'default'...
[09:13:44] Finished 'default' after 14 ms
NO NODE C:\dev\js\css-modulesify-test\C:\C:\style.css C:\dev\js\css-modulesify-test\C:\C:\border.css
Error: Node does not exist: C:\dev\js\css-modulesify-test\C:\C:\style.css
    at Object.DepGraph.addDependency (C:\dev\js\css-modulesify-test\node_modules\dependency-graph\lib\dep_graph.js:87:13)
    at C:\dev\js\css-modulesify-test\node_modules\css-modulesify\file-system-loader.js:102:22
    at FileSystemLoader.fetch (C:\dev\js\css-modulesify-test\node_modules\css-modulesify\file-system-loader.js:65:14)
    at Parser.fetchImport (C:\dev\js\css-modulesify-test\node_modules\css-modules-loader-core\lib\parser.js:90:19)
    at C:\dev\js\css-modulesify-test\node_modules\css-modules-loader-core\lib\parser.js:49:31
    at Root.each (C:\dev\js\css-modulesify-test\node_modules\postcss\lib\container.js:110:22)
    at Parser.fetchAllImports (C:\dev\js\css-modulesify-test\node_modules\css-modules-loader-core\lib\parser.js:47:11)
    at Parser.plugin (C:\dev\js\css-modulesify-test\node_modules\css-modules-loader-core\lib\parser.js:35:31)
    at LazyResult.run (C:\dev\js\css-modulesify-test\node_modules\postcss\lib\lazy-result.js:270:20)
    at LazyResult.asyncTick (C:\dev\js\css-modulesify-test\node_modules\postcss\lib\lazy-result.js:185:32)
path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.resolve (path.js:184:7)
    at DestroyableTransform.saveFile [as _transform] (C:\dev\js\css-modulesify-test\node_modules\vinyl-fs\lib\dest\index.js:36:26)
    at DestroyableTransform.Transform._read (C:\dev\js\css-modulesify-test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (C:\dev\js\css-modulesify-test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (C:\dev\js\css-modulesify-test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (C:\dev\js\css-modulesify-test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (C:\dev\js\css-modulesify-test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:194:11)
    at Readable.ondata (C:\dev\js\css-modulesify-test\node_modules\readable-stream\lib\_stream_readable.js:612:20)
    at emitOne (events.js:96:13)

Note that the paths in the error message still contain "C:\C:\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants