learn-co-curriculum / your-own-js-and-css-in-rails Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
// ♥brew cask install phantomjs
==> Caveats
phantomjs has been officially discontinued upstream.
It may stop working correctly (or at all) in recent versions of macOS.
I received the error about phantomjs not being on my system. I tried brew install phantomjs as suggested in the Readme, however it resulted in a bunch of errors and failed to install. I found the following workaround, which fixed the issues I was having, and I wanted to share as an alternative in case anyone else has trouble installing.
npm install phantom phantomjs -g
I received a weird puma error after getting rid of the Gemfile.lock, and running bundle install
LoadError: Capybara is unable to load
pumafor its server, please add
pumato your project or specify a different server via something like
Capybara.server = :webrick.
Not sure what it is, but I am almost certain I have completed what the specs are testing for. Any feedback would be much appreciated!
I was getting this error:
Cliver::Dependency::NotFound: Could not find an executable ["phantomjs"] on your path.
Did a bit of research and added:
gem 'phantomjs', :require => 'phantomjs/poltergeist'
Now, tests are running fine.
A number of these javascript libs include JQuery by default, but actually using any JQuery will often prevent the tests from passing, even if the code correctly implements the required features.
It may be best to simply remove JQuery from these labs if the tests are not going to be written to allow its use.
Using let results in the following error:
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page. If you don't care about
these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (s
ee documentation for details).
ReferenceError: Can't find variable: hideWhenClicked
I encountered the phantomJS error, after a bit of searching and head scratching I saw the note about this error at the bottom of the lab readme to run brew install phantomjs
upon running that line in the terminal I was vexed to encounter the same issue again. Upon reading through the error in the terminal - the update is: brew cask install phantomjs
(the cask had been left out)
Just a heads up - you might want to update.
sorry for the long explanation.
The text was copied and pasted twice in this lab. It should end after the first Phantom JS Errors section.
Objectives
Write your own CSS and integrate it into the asset pipeline and use it in views.
Write your own JS and integrate it into the asset pipeline and use it in views.
Objectives
Located in this repository is a simple Rails application. Your goal is to create your own JS and CSS and include it into the application. You can run the Capybara spec when you are finished to test your solution.
First add the following JS:
In /app/assets/javascripts/ create the file hide.js
Create the function hideWhenClicked that hides the element that was clicked.
Make sure to bind to #hide_this
Add hide.js to your JS manifest.
Note: If declaring any variables in your JavaScript file, use var instead of let or const or else Capybara will throw this error:
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page. If you don't care about
these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (s
ee documentation for details).
Next add the following CSS:
In /app/assets/stylesheets/ create the file links.css
Create a CSS class called .error that changes the color of the text to red. Add this CSS class to the link on the root page.
Create another CSS class called .cool-background that makes the background grey. Add this CSS class to the tag on the application layout.
Add links.css to your CSS manifest.
PhantomJS Errors
If you receive this error:
Could not find an executable ["phantomjs"] on your path.
Install it with: `# Your Own Js And Css In Rails
Objectives
Write your own CSS and integrate it into the asset pipeline and use it in views.
Write your own JS and integrate it into the asset pipeline and use it in views.
Objectives
Located in this repository is a simple Rails application. Your goal is to create your own JS and CSS and include it into the application. You can run the Capybara spec when you are finished to test your solution.
First add the following JS:
In /app/assets/javascripts/ create the file hide.js
Create the function hideWhenClicked that hides the element that was clicked.
Make sure to bind to #hide_this
Add hide.js to your JS manifest.
Next add the following CSS:
In /app/assets/stylesheets/ create the file links.css
Create a CSS class called .error that changes the color of the text to red. Add this CSS class to the link on the root page.
Create another CSS class called .cool-background that makes the background grey. Add this CSS class to the tag on the application layout.
Add links.css to your CSS manifest.
PhantomJS Errors
If you receive this error:
Could not find an executable ["phantomjs"] on your path.
Install it with: brew cask install phantomjs
Some tests failed with error:
Cliver::Dependency::NotFound: Could not find an executable ["phantomjs"] on your path.
Adding gem 'phantomjs', :require => 'phantomjs/poltergeist'
fixed this issue
The instructions say to install phantomjs with brew cask install phantomjs
, however, that does not work on Windows. To install it, add the gem ‘phantomjs’, :require => ‘phantomjs/poltergeist’ to your gemfile. Delete gemfile.lock first and then bundle install.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.