Sublime Forum

Separate syntax for strings? (javascript + glsl)

#1

I’m working on a webgl project where I often have strings of shader code in the same file as javascript code. Where I can have a shader in a separate file, I can make a syntax setting for .vs.js, or .fs.js extensions and use a glsl syntax plugin, but more often I need to edit shader code sitting in a string in a regular javascript file. Is there any way to create a setting or a new syntax definition to view the file as javascript, but strings within the file using the glsl syntax?

If so, I’d be really interested to here any suggestions of how this is done.

Thanks!

0 Likes

#2

If you are using JS Custom as a source of JavaScript syntax highlighting, then it gives you some configurations to set different types of syntax within template literals based on the conditions.

Look in the personalization section of the README

0 Likes

#3

That worked!

0 Likes