.ejs files in Sublime default to file type "Plain Text" - express

I'm new to coding and I'm using the Express framework in Sublime.
When I create .ejs files, (for example footer.ejs) for some reason Sublime shows these files as Plain Text files, instead of .ejs files, even though I have NPM installed ejs.
Furthermore, when I click on "Plain text" in the bottom right of Sublime, EJS doesn't show up as an option.
My package.json shows that I have ejs installed: "ejs": "^2.5.9".
Does anyone know what I'm doing wrong? And how I can get .ejs files to automatically default to EJS instead of plain text? Thanks!

The short version of the answer to your question is that installing a package via npm doesn't have any effect on Sublime. In order to add support for EJS to Sublime you need to install a package for it in Sublime.
Package Control has a couple of packages, EJS and EJS 2 (and maybe also Hyperloop EJS, if that's a thing; I'm unfamiliar with EJS).
Just at first blush it seems like EJS 2 might be the better first bet; it's been more recently updated and is using the newer sublime-syntax syntax format and seems to support more things. Take that with a grain of salt though, since I have no experience with either one.
You can select the command Package Control: Install Package from the command palette and then select one of those packages to install it. If you're going to try them both, do it one at a time and use Package Control: Remove Package before installing the next one so that they don't compete with each other.
If those commands aren't in your command palette, you don't have Package Control installed yet. In that case you can select Install Package Control from the command palette to install PC first. If that doesn't work there are also instructions on how to install it manually.
Once you have a package installed, you can close and reopen the file to apply the correct syntax, or use the menu as you mention in your question.

Let's make it short and simple.
Syntax highlighting and auto completions are not great if you were to download ejs package.
Instead I recommend you to use html syntax highlighting.
Open Command pallet using ctrl+ shift + P or cmd + shift + P.
Set Syntax: HTML

Related

What is the recommended way to update project.pbxproj file for the app while upgrading react-native version

I am using rn-diff to upgrade react-native version for my app. Sometimes, the project.pbxproj is updated to contain some new dependencies or updates to the existing dependencies. What is the recommended way to update this file? I don't think that I can just copy and paste the changes shown in the diff because it may create some duplicates or create some conflicting entries in the file.
For example, below link contains changes made to the project.pbxproj file while changing from version 0.54.4 to 0.55.0. There are a lot changes to the project.pbxproj file and I am not sure if I am supposed to copy them over or I should rather be updating some dependencies myself in Xcode.
https://github.com/ncuillery/rn-diff/compare/rn-0.54.4...rn-0.55.0
In such cases I'm usually sad that I need to do this terrible thing ;)
But being serious: sadly going through RN Diff is like the very best thing that you can do now (unless you have NOT detached Expo.io but then you wouldn't probably ask here). So basically you go through each change that happened between your version and version to which you want to update and copy paste the changes in these files. As rarely you can apply patches (because your project file will be so different that there is no way that it will work out correctly).
My way of doing it is:
- see what changed
- see code block next to it, that is somehow easy to find out in my code (like some block of code that has unique ID + few properties around e.g. can be some native modules that are always there like TEXT or View or whatever, something which is always in RN)
- find the same element in my code and paste the new code above / below that code that was the same
Rinse and repeat
Please take a look at Upgrading to new React Native versions for upgrading your react native version!
Also if you want to update all of your dependencies, you can:
npm i -g npm-check-updates
ncu -u
npm install
And there is a library called npm-check-updates which:
Find newer versions of package dependencies than what your package.json or bower.json allows!

Configuring Groovy SDK within IntelliJ IDEA

I am running IntelliJ IDEA 2017.2.3. I installed Groovy 2.4.12 via Homebrew (OS X). When I open a Groovy source file (or a Jenkinsfile), I get the following:
Groovy SDK is not configured for module 'my-module' . . . . . Configure Groovy SDK...
Clicking "Configure Groovy SDK..." leads me to the following dialog:
I tried hitting "Create..." and selecting many different Groovy-related folders and executables, but nothing works.
How can I get IntelliJ IDEA to accept my Groovy SDK?
IntelliJ IDEA expects the standard Groovy SDK layout which is provided with the official distributions available at https://groovy.apache.org/download.html. Just download, unpack into any directory, specify this directory as the library home.
Homebrew package layout may be different, however it may have the standard layout in the libexec subdirectory in some cases. Try /usr/local/opt/groovy/libexec (use Cmd + Shift + G to navigate to it).
Another suggestion to add to this solution here described in MAC OS you can also add symbolic link in Library. This will make it easy to select it within IntelliJ:
sudo ln -s /usr/local/opt/groovy/libexec /Library/Groovy
This first answer it excellent, but not sufficient. The hidden folder in Mac blocked me one more day.
On Mac system, you can press
Cmd + Shift + G
to invoke the input dialog and input "/usr/local/opt/groovy/libexec" directly to resolve the issue that you cannot find the lib folder.
CrazyCoder gave the correct hints. But some of us use brew as our standard.
brew install groovysdk
In intellij when you get the dialog, as stated by haltTim, Cmd + Shift + G
Navigate to /usr/local/opt/groovysdk/libexec or the cellar path /usr/local/Cellar/groovysdk/???/libexec
From the main menu select File | Project Structure ⌘;.
In the Project Structure dialog, under Platform Settings, select
Global Libraries.
Image depicting the Intellij environment
Select Global Libraries, if nothing is there, click on add(+) icon at the top.
Then a small dialog box will appear, Select "from Maven", then another dialog box as shown below appears, iamge showing dialog box
Type in Groovy, then several options will pop up, select an option which has groovy:groovy-all and version 2.4.1(change version according to your need) and click ok. then apply and ok,
After this go to the same dialog box, of Configure SDK and select from drop-down.

How can I get HAML syntax styling to work in Sublime Text?

I tried following the instructions but I've had no luck getting HAML to show up as an option in the Syntax list. I've got package control installed, I just don't know how to get the HAML in there.
I'm using Sublime Text 3.
Currently, I'm just using the Ruby Syntax instead which seems to be ok but the documents never remember that I picked that.
You need to install the Haml package with Package Control. Open the Command Palette (Tools -> Command Palette) and type in pci to bring up the Package Control: Install Package option. Hit Enter, and wait for the package list to load. Once loaded, type haml and select the first entry - it should say HAML Bundle for Textmate. Hit Enter, and watch the status bar at the bottom of the window until it prints a message about successfully installing the package. You can now select Ruby HAML from the list of syntaxes.

Error Less2CSS plugin while compiling less file in Sublime Text 2

I installed Sublime Text 2 and Node.js.After that i install less with that command npm install -g less with command console.When i install Less2CSS plugin and try to compile less file then i am getting error The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.I found the same issue on here also.But i didn't understand what and which file to change.please help me if anyone have same issue.I attached the screen shot for more understand the issue.Thank you everyone.
To fix this issue, go to Sublime Text and:
Go to Preferences > Browse Packages
Open the Less2css folder
Open the lesscompiler.py file in a text editor
Go to line 184 and change this
cmd = [lessc_command, less, css, "-x", "--verbose"]
to this
cmd = [lessc_command, less, css, "--clean-css", "--verbose"]
Save the file, restart Sublime Text, and attempt to save your LESS file again.
It means that the option is not supported. it recommend you use a dedicated css minifier.
You can change the option.
Via "Preferences" -> "Package Settings" -> "Less2Css" -> "Settings - Default".
change ["minify": true,] to ["minify": false,]
and then, if you want to minify the css file, please use a dedicated css minifier to do this.

WebStorm syntax highlighting for Swig template engine

Given:
The Swig template engine: http://paularmstrong.github.io/swig/
Webstorm has a plugin for it: Textmate bundles support
A Textmate bundle for Swig is available: https://github.com/paularmstrong/Swig.tmbundle
I expect I should be able to get Swig highlighting fixed, but I'm only getting half way.
Below is the resulted highlighting I get. The Swig code is highlighted as expected, but HTML is not highlighted anymore.
I've tried installing and enabling the HTML textmate bundle as well, but when both the HTML and the Swig bundle are activated, the code is highlighted as only HTML. If I disable the HTML bundle but have the Swig bundle still active, I only get Swig highlighting.
My Question: How do I get Swig code and HTML code highlighted in the same file in WebStorm on Windows?
Result:
This is my Textmate Bundles configuration in WebStorm 9:
Again, simply selecting the HTML bundle to enable it doesn't work.
Swig has nearly identical syntax to Twig, so we can assume they can be used interchangeably speaking of syntax highlighting and code completion.
The thing is that PHPStorm it has a Twig support throught a plugin (which is awesome BTW), but sadly it is not available in the others IDEs thought the Plugins menu.
This issue can be solved by:
manually downloading the plugin from the official repo at https://plugins.jetbrains.com/plugin/7303?pr=
then installing it manually thought the Plugin interface,
then or use the .twig extension on files or adding a new mapping in the File Types system menu for the type Twig, with wildcard *.html or *.swig, how you prefer.
I'm using the *.html workaround and work like a charm, both Swig & HTML syntax highlighting + code completion.
Hope this helps you like it did to me :)