Enable sourcemaps (in Sass) and more.

112 views
Skip to first unread message

Johan Borestad

unread,
Dec 8, 2012, 4:56:28 PM12/8/12
to mimo...@googlegroups.com
Hi again!

What is the simpliest way to override plugin settings in mimosa.
In my case I want to add a specific debug param to the scss compiler

I've installed compass, but don't know howto link the config.rb file.

Johan Borestad

unread,
Dec 8, 2012, 5:52:59 PM12/8/12
to mimo...@googlegroups.com
So...I've at least found the place where to look.
In sass-compiler.coffee, if I add 

compilerOptions.push '--debug-info'

then it will at least generate some debug-info, but it seem to be missing the path and filename.
This is an example:

@media -sass-debug-info{filename{}line{font-family:\000034}}

but it should more look something like this:
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/lensco\/Sites\/lensco\/sass\/style\.scss}line{font-family:\0000336}}
Message has been deleted

Johan Borestad

unread,
Dec 8, 2012, 7:07:10 PM12/8/12
to mimo...@googlegroups.com
So...my qualified guess is that debug-info is impossible to use together with the stdin option. (Compass should have a --debug-info-set-filename option)
Is the stdin used for performance reasons?

Anyway, I have a fix for it.

By just setting compilerOptions to this.
compilerOptions = [fileName,  '--debug-info', '--no-cache']

I don't know what kind of implications this will have though, but it seems to work. Although, this should of course not be set in production, but I don't have a solution for that yet.
Message has been deleted

dbashford

unread,
Dec 8, 2012, 7:24:51 PM12/8/12
to mimo...@googlegroups.com
I just started looking and yeah, fileName is necessary, also not sure what problem there might be with that, if any.  Need to play a little.

Both the --debug-info and the fileName ought not be set in prod, since they are just needed to enable source maps.  The way I have been and intend to handle that sort of thing is to base the decision to add it on `mimosaConfig.isBuild`.  If you are building the app, mimosa does all the compiling and exits.  Source maps don't do any good if you aren't serving them.  `mimosa watch` is where you'd want souce maps.  This ought to do.

unless config.isBuild
  compilerOptions.unshift fileName, "--debug-info"

stdin is used, in part, for performance reasons.  I've already read the text in.  So I can spit it to stdin.

If those two lines do the trick, I'd be happy to add them.  Obviously need to test them out.  I have a pretty big app using SASS at work I can test it out on.

Johan Borestad

unread,
Dec 8, 2012, 8:32:46 PM12/8/12
to mimo...@googlegroups.com
Interesting bug.... i tried those lines, but that overwrote the original .scss file with debug-info instead :-)

Still though, no filename. I played around a bit and googled around, haven't found any solution for stdin and debug-info yet.
Is the performance win by using stdin that big that it would be worth it to sacrifice sourcemaps?

Thanks for your help!

dbashford

unread,
Dec 8, 2012, 9:35:40 PM12/8/12
to mimo...@googlegroups.com
To not use stdin means to let SASS write files, which I want to avoid because it bypasses the back half of mimosa's asset handling.  It has to be run via a node spawn, which, among the 3 CSS, and 4 JS, and 9ish Template compilers makes it the only one that has to run like that because there isn't a satisfactory node compiler.

Writing over the source probably isn't a bug, fairly certain its doing what its told.  It's writing the output to the file you gave it in the filename.  With stdin that is probably its default behavior. Take stdin input and write it to file X.  I would guess if you set that value to file.outputFileName, that it would write it there and give you want you want.  Mimosa won't have anything to handle after that step though, so no CSS lint, etc.  Probably no notice that it was written either.  Those are all reasons to not let sass do the writing.

To deal with what can only be called a bug with SASS, I suppose I could...

- Let it write it to a temp file next to the source file
- Read the file in
- Remove the file
- Treat the read in content as the compiled source, because it is, and let mimosa continue on its way

dbashford

unread,
Dec 10, 2012, 12:24:57 PM12/10/12
to mimo...@googlegroups.com
Didn't mean to leave this hanging.  I have a few things I need to get done to wrap up the next release, and then a few things lined up for immediately following, but I can add this to the queue for post 7 release.  I really don't care how nasty the solution is as long as it preserves mimosa's workflows and is transparent to the user.

Considering this is source map related, and one of my next tasks is to start working with and understanding source maps (already started with mimosa-minify), it dovetails nicely.

Johan Borestad

unread,
Dec 10, 2012, 12:44:07 PM12/10/12
to mimo...@googlegroups.com
Thanks a lot! This is the only blocker I've seen so far for me. Fixing this would make me gonna use mimosa fulltime!

Appreciate your hard work a lot! :)
 

dbashford

unread,
Dec 10, 2012, 12:50:29 PM12/10/12
to mimo...@googlegroups.com
You could switch to Stylus =p

Steve Kleiman

unread,
Mar 12, 2014, 9:46:11 PM3/12/14
to mimo...@googlegroups.com
This dated thread is most recent I found regarding SASS sourcemaps. Feel like I'm missing something on how to achieve that goal.

In Mimosa source, I don't see any flags available to be sent to either SASS compiler. Maybe it's the same 2012 stdin consideration?

Sorry if I missed this somewhere in docs, but are SASS sourcemaps not available? Ideally SASS files created by 'mimosa-combine' would map back, but I know that's a lot of moving parts.

Thanks.

dbashford

unread,
Mar 14, 2014, 9:45:49 AM3/14/14
to mimo...@googlegroups.com
If you are using Ruby SASS, I'm not sure i'd be able to capture the output because I am just working with stdin.

However, it does look like node-sass supports source maps now.  So I can add that to my todo list.

Steve Kleiman

unread,
Mar 15, 2014, 3:46:57 AM3/15/14
to mimo...@googlegroups.com
node-sass supports source maps now but has same limitation as cited previously in this thread, namely that Mimosa uses stdin and not writing files.

For node-sass, setting "sourceComments=map" gets sourcemaps but with the caveat, "sourceComments is only supported when using the file option, and does nothing when using data flag."

Here's where that 'data' flag gets passed from Mimosa:

dbashford

unread,
Mar 17, 2014, 11:13:55 AM3/17/14
to mimo...@googlegroups.com
So given the way that works it'll be hard. Not impossible.  It's often the case that features like this are somewhat easy to add, this isn't that case.  I'd need a day or two of free time carved out for this.

I definitely want to do it and you've made me think about it again for the first time since 2012 =p

Partap Davis

unread,
Feb 23, 2015, 6:58:00 PM2/23/15
to mimo...@googlegroups.com
Any update on sass sourcemaps in mimosa?

dbashford

unread,
Feb 23, 2015, 7:12:18 PM2/23/15
to mimo...@googlegroups.com
mimosa-sass supports source maps if using node-sass.

Partap Davis

unread,
Feb 25, 2015, 6:02:54 PM2/25/15
to mimo...@googlegroups.com
 
mimosa-sass supports source maps if using node-sass.
 
How do I do that?  I've got both sass and node-sass installed, but I don't see a setting to tell mimosa what to use... 

GMail

unread,
Feb 25, 2015, 6:42:53 PM2/25/15
to mimo...@googlegroups.com
It's in the docs.  Believe it's "lib"

Sent from my iPhone

On Feb 25, 2015, at 6:02 PM, Partap Davis <chee...@gmail.com> wrote:

 
mimosa-sass supports source maps if using node-sass.
 
How do I do that?  I've got both sass and node-sass installed, but I don't see a setting to tell mimosa what to use... 

--
You received this message because you are subscribed to the Google Groups "mimosajs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mimosajs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages