ColorHighlighter icon indicating copy to clipboard operation
ColorHighlighter copied to clipboard

color_variables_files does not work

Open HughxDev opened this issue 8 years ago • 12 comments

Using:

  • Windows 7 32-bit
  • Sublime Text 2 (Version 2.0.2, Build 2221)
  • Color Highlighter v2016.02.11.13.53.03

.sublime-project:

{
  "color_variables_files":
  [
    "/path/to/_colors.scss"
  ],
  "folders":
  [
    {
      "path": "/path/to/project"
    }
  ]
}

_colors.scss:

$FACEBOOK_BLUE: #3b579d;

facebook-blue

app.scss:

$foo: $FACEBOOK_BLUE;

color-highlighter

HughxDev avatar Feb 17 '16 20:02 HughxDev

The path must be incorrect. Currently it only supports absolute paths.

Monnoroch avatar Feb 18 '16 11:02 Monnoroch

I triple-checked and it's the correct path, as well as being absolute. I actually copied the exact location from the file properties dialog box, pasted it into the .sublime-project, and then changed all slashes from Windows-style (C:\...) to UNIX-style (/C/...), which seems to be the format that Sublime Text expects. Not only that, but I also tried several variations, including keeping them as backslashes and escaping them. I even tried renaming a folder that had spaces in it in case that was causing any problems, but it didn't make a difference. It has to be something else.

HughxDev avatar Feb 18 '16 21:02 HughxDev

It's working fine using absolute path, on windows 7 64bit.

Try this on your .sublime-project file

{
  "color_variables_files": "/path/to/_colors.scss", 

  "folders": [{
      "path": "/path/to/project"
    }]
}

Hope it works!

akazorg avatar Mar 10 '16 11:03 akazorg

If you're on Windows, the pathing will be a little different from what I understand. In a project I'm working on, it looks a little like this:

"color_variables_files": [ "D:\\code\\website-project.local\\client\\scss\\variables\\_colors.scss" ],

Does that help?

mikehdt avatar Mar 19 '16 22:03 mikehdt

+1 same issue.

Tried the filepath a string and an array.

Tried using color_variables_file instead of color_variables_files.

Tried Windows style and unix style file paths (using Windows 10).

treechime avatar Jul 04 '16 23:07 treechime

I got this to work on a mac by using the absolute path thus:

{
	"folders":
	[
		{
                      "path": "."
                }
	],
       "color_variables_files": "/Users/myusername/path/to/_colors.scss",
}

lisajwells avatar Feb 02 '17 17:02 lisajwells

Unable to get this working, ST3 macOS sierra. Can we have a log in the ST console telling us what's the deal ? File not found, syntax error ...

Romainpetit avatar Apr 05 '17 10:04 Romainpetit

I can confirm that color_variables_files does not work even when using absolute paths.

{
  "folders": [{
    "path": "."
  }],
  "color_variables_files": "/Users/username/project/assets/_sass/settings/_colors.scss"
}

macOS Sierra 10.12.14 Sublime Text 3 build 3126

jonsuh avatar Apr 08 '17 04:04 jonsuh

I figured out what’s going on.

For color_variables_files to work in the .sublime-project file, you need to save your directory as a “Sublime project” (From the menu, Project > Save Project As) (it creates a *.sublime-workspace file) and always open projects as a “Sublime project.”

However, I think the whole “Sublime project” thing is useless. So my forked version https://github.com/jonsuh/ColorHighlighter uses a .colorhighlighter file that’s structured like this:

{
  "color_variables_files": [
    "/absolute/path/to/project/assets/_sass/settings/_colors.scss"
  ]
}

It doesn’t require you to save and open a folder as a “Sublime project” and color highlighting for Sass variables work again (!!!) even if your variables are in a separate file and you’re not @importing color variables in every Sass file (I use one manifest file so it’s redundant to @import in every file).

image

jonsuh avatar Apr 12 '17 15:04 jonsuh

Amazing job @jonsuh !

Finally got it working using your fork. I think you solution deserves a PR in this repo instead. 🙌 Kudos to you !

Romainpetit avatar Apr 13 '17 07:04 Romainpetit

@Romainpetit Great to hear that it’s working for you! Thanks for letting me know.

I opened up a PR for the added feature https://github.com/Monnoroch/ColorHighlighter/pull/355. This is only the 2nd time that I’ve ever written anything in Python, so it may need improvement from more experienced devs, but hopefully we can get the feature added.

jonsuh avatar Apr 13 '17 13:04 jonsuh

At first I was putting "color_variables_files" inside of "folders" key for some reason...

The default .sublime-project (in the project root, didn't check other locations of .sublime-project) worked for me:

{
	"color_variables_files": [
		"/Users/myuser/project/styles/_variablesFilename.scss"
	],
	"folders": [{

johny-gog avatar May 05 '17 13:05 johny-gog