matype/postcss-style-guide

Error when attempting to build styleguide

faceleg opened this issue · 8 comments

Is there something I'm missing?

  gulp.task('css', function() {
    return gulp.src('css/core.css')
      .pipe(postcss([
        require('postcss-import')({
          path: __dirname + '/css/'
        }),
        require('postcss-nested')(),
        require('postcss-extend')(),
        require('postcss-simple-vars')(),
        require('postcss-calc')(),
        require('postcss-color-function')(),
        require('autoprefixer')(),
        require('lost')(),
        require('postcss-at2x')(),
        require('postcss-style-guide')({
          showCode: true,
          name: '66pix',
          dir: 'styleguide'
        })
      ]))
      .pipe(gulp.dest('public/css'));
  });

[19:47:18] Error: ENOENT: no such file or directory, open '/Users/faceleg/Sync/faceleg/Work//services/web-frontend/node_modules/postcss-style-guide/node_modules/psg-theme-default/template.ejs'
at Error (native)
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:431:33)
at /Users/faceleg/Sync/faceleg/Work//services/web-frontend/node_modules/postcss-style-guide/index.js:34:27
at creator (/Users/faceleg/Sync/faceleg/Work//services/web-frontend/node_modules/postcss/lib/postcss.js:60:39)
at Function.postcss.plugin (/Users/faceleg/Sync/faceleg/Work//services/web-frontend/node_modules/postcss/lib/postcss.js:66:23)
at Object. (/Users/faceleg/Sync/faceleg/Work//services/web-frontend/node_modules/postcss-style-guide/index.js:12:26)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)

Hi morishi,

As you might have already known, this problem seems related to a flat node_modules in npm v3. This means it should not to depend a simple path as a string like here because now it couldn't be sure where is the child module in whether same directory or parent directory or the other case or not.
Here is a one of the simple solution. Adding a index.js file in the default theme module to return something like a __dirname or a style string. https://github.com/morishitter/psg-theme-default/compare/master...watilde:feature/return-path?expand=1

Thanks!

@watilde Thank you for your advice! I will learn npm v3 in your awesome slides :)

@faceleg Please update postcss-style-guide to v0.9.1.

Will do, thanks!

Hilariously, this failed for me just when I was demoing it to a fellow programmer.

Finally, can I please have a link to the slides?

@morishitter Oh you also need to take in this patch to use the index.js in the default theme module we just added. Let me know if you have any questions Thanks for your time!

@watilde Thanks for your PR :)

@faceleg Sorry for my bad, I just released v0.9.2. Please update to the latest version.