FountainJS / generator-fountain-webapp

Yeoman 'fountain' generator to start a webapp
http://fountainjs.io
MIT License
963 stars 67 forks source link

css source maps #177

Open IdanCo opened 7 years ago

IdanCo commented 7 years ago

Hi,

All CSS attributes in chrome inspector points to without any reference to the original files. any idea why or how to fix?

{ "generator-fountain-angular1": { "version": "1.0.0-rc2", "props": { "css": "scss", "resolved": "/Users/idancohen/.nvm/versions/node/v4.2.4/lib/node_modules/generator-fountain-webapp/node_modules/generator-fountain-angular1/generators/app/index.js", "framework": "angular1", "argv": { "remain": [], "cooked": [], "original": [] }, "js": "babel", "modules": "webpack", "ci": [], "namespace": "fountain-angular1", "sample": "techs", "router": "uirouter" } } }

Node.js v4.2.4 darwin 16.3.0 yo 1.8.5 npm 4.1.1

solova commented 7 years ago

I touched the same. I hope easist solution exists, but I found only this.

1) add ExtractTextPlugin to webpack.conf.js (just copy from webpack-dist)

const ExtractTextPlugin = require('extract-text-webpack-plugin');

2) replace stylesheets section with

{
    test: /\.css$/,
    loaders: [
        'style-loader',
        'css-loader',
        'postcss-loader'
    ]
}, {
    test: /\.scss$/,
    loaders: ExtractTextPlugin.extract({
        fallbackLoader: 'style-loader',
        loader: 'css-loader?sourceMap!sass-loader!postcss-loader'
    })
}

3) add ExtractTextPlugin to plugins section

new ExtractTextPlugin('styles.css')

4) extend LoaderOptionsPlugin options section with

sassLoader: {
  includePaths: [path.resolve(__dirname, 'src', 'scss')]
},
context: '/'
IdanCo commented 7 years ago

it almost worked :-)

Instead of