Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

CSS sourcemap's path is incorrect. #364

Closed
everthis opened this issue May 9, 2014 · 12 comments
Closed

CSS sourcemap's path is incorrect. #364

everthis opened this issue May 9, 2014 · 12 comments

Comments

@everthis
Copy link

everthis commented May 9, 2014

webapp_issue

can't find the .scss file.
In the console the path is: http://localhost:9000/app/styles/main.scss
which should be: http://localhost:9000/styles/main.scss
I hope to hear some workaround. Thanks.

@eliberov
Copy link

eliberov commented Jun 4, 2014

same issue here

@everthis
Copy link
Author

everthis commented Jun 4, 2014

Hi, @eliberov ,I have found a workaround:just set the .tmp directory's path inside app folder.
problem solved.

@eddiemonge eddiemonge added this to the 0.5.0 milestone Jun 19, 2014
@eddiemonge
Copy link
Member

What options did you set? Did you use Ruby Sass or node-sass?

@everthis
Copy link
Author

1,no customized settings,just a fresh webapp;
2,node-sass

@stevemao
Copy link
Collaborator

stevemao commented Jul 2, 2014

confirm that Ruby Sass has the same problem.

@mvaldesdeleon
Copy link

Hi All. I've been able to solve this issue by adding grunt-sed to the mix.

Sadly, this grunt plugin doesn't support glob expansion in the path attribute, so I cannot force it to process just the css.map files.

        // Fix the source-maps
        sed: {
            sourcemap: {
                path: '.tmp/styles/',
                recursive: true,
                pattern: '"([^"]*)/<%= config.app %>\\/styles\\/([^"]*\\.scss)"',
                replacement: '"$1/styles/$2"'
            }
        },

I have added this task to run after autoprefixer on the serve task, which is where I'd need it.

I've noted that the grunt-sed plugin is quite outdated. The same solution could be implemented via the grunt-contrib-copy plugin already present, I believe. Yet another implementation could be achieved with the grunt-replace plugin.

In case this solution seems viable, I could supply my current version.

@oori
Copy link

oori commented Sep 25, 2014

Here's another workaround: yeoman/generator-angular#574 (comment)

@htanjo
Copy link
Contributor

htanjo commented Nov 28, 2014

I fixed this issue in another approach.
I added a route to resolve the reference to the connect server.

connect: {
  ...
  livereload: {
    options: {
      middleware: function(connect) {
        return [
          connect.static('.tmp'),
          connect().use('/bower_components', connect.static('./bower_components')),
          connect.static(config.app),
          // Resolve the reference from map file.
          connect().use('/' + config.app + '/styles', connect.static('./' + config.app + '/styles'))
        ];
      }
    }
  },
  ...
},

It works fine with both Ruby Sass and Libsass.
When you use Libsass, you should update grunt-sass to v0.16.0+ at first.

If this patch is welcome, I'll send a pull request.

@djmtype
Copy link

djmtype commented Jan 13, 2015

Any fix for getting (grunt-contrib-sass) Sass source maps to show up in Web Inspector?

Tried adding connect().use('/' + config.app + '/styles', connect.static('./' + config.app + '/styles')) as specified by @htanjo. But, that made no difference here.

The sourcemap is being generated to .tmp > styles > main.css.map. However, it's not showing up in web inspector when running grunt serve.

Am I missing something?

@htanjo
Copy link
Contributor

htanjo commented Jan 14, 2015

Hi @djmtype, are you using the master branch of yeoman/generator-webapp?
The published version (v0.5.1 in npm) has another issue, Autoprefixer removes the sourcemap comment. This fix yeoman/generator-webapp@58cb3b9 is not released for now.

I hope this helps.

@djmtype
Copy link

djmtype commented Jan 14, 2015

@htanjo Now, that's a wonderful thing. Cheers!

@silvenon
Copy link
Member

The fix is released in v0.6.1.

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

No branches or pull requests

9 participants