Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use regex expression in control logic? #44

Open
BartlomiejSkwira opened this issue Apr 20, 2015 · 1 comment
Open

How to use regex expression in control logic? #44

BartlomiejSkwira opened this issue Apr 20, 2015 · 1 comment

Comments

@BartlomiejSkwira
Copy link

When I try to do:

- whatever = "hello world".replace(/ /g, '_')

I get

Uncaught Error: ExecJS::RuntimeError: SyntaxError: [stdin]:57:38: unexpected /
  (in /.../my_file.jst.skim)

There is a problem with / - ideas how to workaround this other then extracting that logic outside the .skim template?

Versions:
Skim: 0.9.3
Slim: 2.0.2

@gkopylov
Copy link
Contributor

Hi, @BartlomiejSkwira. I check your issue for master branch of Skim and Slim 3, and everything works fine. So this code:

- whatever = "hello world".replace(/ /g, '_')
- console.log whatever

outputs hello_world

You can update slim to version 3 and use this in your Gemfile:

gem 'skim', :git => 'https://github.com/jfirebaugh/skim.git'

or

gem 'skim', :git => 'https://github.com/gkopylov/skim.git', :branch => 'change_sprockets_version_dependency'

(if you want to use fresh version of sprockets gem).

And regard to Slim 2.0.2... I have not enough time to figure out with this issue, so you can just update versions or wait some time - may be someone else fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants