Comments (10)
I managed to highlight pug` with JSCustom https://packagecontrol.io/packages/JSCustom
{
"configurations": {
"Default": {}, "React": {"file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true}
, "ReactPug": {
"file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true,
"custom_template_tags": {
"pug": "scope:text.pug"
}
}
}
}
from babel-plugin-transform-react-pug.
I managed to highlight pug` with JSCustom https://packagecontrol.io/packages/JSCustom
{ "configurations": { "Default": {}, "React": {"file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true} , "ReactPug": { "file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true, "custom_template_tags": { "pug": "scope:text.pug" } } } }
@tgenuino Hi, I tried your method, but it does nothing for me. I am using Ecmascript-Sublime for js by default. Do I need some other way to turn the JSCustom config on?
This is my config on JSCustom. Thanks.
Select the sintax "JS Custom - ReactPug"
On windows, I think its inside User -> Js Cust...
from babel-plugin-transform-react-pug.
@tgenuino, thank you
from babel-plugin-transform-react-pug.
@actuallymentor cool, I believe that the idea will be as simple as for Atom, but will try to help you with that soon.
from babel-plugin-transform-react-pug.
@actuallymentor I had a chance to make small research. Here is what I found: to get correct syntax highlighting for Flow (and maybe more things) there is a plugin borela/naomi.
To get syntax highlighting for pug in js we can create own syntax there and inherit existed one:
— Example: https://gist.github.com/subhaze/a754c8d17906f2a25ce2
— Documentation: http://www.sublimetext.com/docs/3/syntax.html
from babel-plugin-transform-react-pug.
Thank you for helping out so quickly!
I've read the documentation, but I don't fully understand it yet, could you elaborate on:
- What you mean by 'Flow'?
- In the .sublime-syntax:
- How does one set the 'parent' highlight? I want to use Babel + this custom template literal. I'm guessing the gist sets it with
meta_content_scope: text.html.basic.embedded.js
- How does one include pug into the template literal scope? With the gist you link I am managing to make the literal highlight html (probably because of
include: 'scope:text.html.basic'
) but I have no idea what the scope name of other syntaxes is supposed to be
- How does one set the 'parent' highlight? I want to use Babel + this custom template literal. I'm guessing the gist sets it with
from babel-plugin-transform-react-pug.
So I figured out how to make the literal understand pug:
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
name: Js with Template Literals
file_extensions:
- js
scope: source.js.literal
contexts:
main:
- match: ""
push: scope:source.js
with_prototype:
- match: 'pug`' <-- this matched a literal only if it is prepended by pug
push:
- meta_content_scope: text.html.basic.embedded.js
- include: 'scope:text.pug' <-- This sets the highlighting ro pug
- match: '`'
pop: true
I still don't really understand how to involve babel in all of this...
from babel-plugin-transform-react-pug.
I have resovle it perfectly by use Ecmascript-Sublime sublime extentsion!
git clone https://github.com/bathos/Ecmascript-Sublime to you sublime Packages path,
then modify its ecmascript.sublime-syntax source file.
@see:
bathos/Ecmascript-Sublime#62
from babel-plugin-transform-react-pug.
I managed to highlight pug` with JSCustom https://packagecontrol.io/packages/JSCustom
{ "configurations": { "Default": {}, "React": {"file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true} , "ReactPug": { "file_extensions": ["js", "jsx"], "flow_types": true, "jsx": true, "custom_template_tags": { "pug": "scope:text.pug" } } } }
@tgenuino Hi, I tried your method, but it does nothing for me. I am using Ecmascript-Sublime for js by default. Do I need some other way to turn the JSCustom config on?
This is my config on JSCustom. Thanks.
from babel-plugin-transform-react-pug.
Does anybody here have any luck getting LSP-Typescript to show type hints inside js attributes in pug?
from babel-plugin-transform-react-pug.
Related Issues (20)
- `class` property was broken, like pug`div( class="container" )` HOT 14
- Case fall through doesn't work HOT 1
- Can't change "React.Fragment" output — Babel's transform react-jsx plugin doesn't honor the "pragmaFrag" option
- create-react-app integration instructions are out of date HOT 3
- How to get around "Unescaped, buffered code is not supported in react-pug" HOT 1
- pug-as-jsx-loader is not good, but their readme looks better HOT 3
- Integration with Ionic React Typescript HOT 1
- start server with errors HOT 5
- Problems in Webstorm HOT 3
- Next js, TypeError: Cannot read property 'Fragment' of undefined HOT 2
- special characters in class names -- i.e. tailwindcss HOT 2
- not support tsx? HOT 3
- Couldn't you just use webpack
- Is it possible to use webpack's rawloader to feed this plugin template files as strings?
- Doesn't work with webpack, ts-loader, babel with `tsconfig.json > target: "es5"` configuration.
- prop spreading (support attribute blocks) HOT 2
- Support tsx
- SWC plugin HOT 3
- support for esbuild?
- Proposal: typescript react-pug plugin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-transform-react-pug.