In a tutorial I am following it tells me the following:
In the terminal you can run
$ ruby page_generator.rb
This will loop through all the files in the `views` directory, parse their erb and write the contents to the `public` directory.
Run the generator and drag a page from the `public` directory to your browser, it should render.
When I run the
$ ruby page_generator.rb
I get:
================================================
=== Converting files in /views to html =========
================================================
- Reading views/index.html.erb
- Converting .html.erb to html
- Writing public/index.html
- Reading views/me.html.erb
- Converting .html.erb to html
- Writing public/me.html
================================================
=== Done, open files in /public with browser ===
================================================
I am unsure what "open files in /public with browser" means? I've tried dragging, running the server(localhost), not sure what I'm supposed to do to get it to render on my browser? Any insight into what the tutorial is trying to tell me to do?
It should refer to the public/ folder located inside the root folder of your Rails application; try to look there
Related
I have a Rails app with asset pipelining disabled.
All my javascript files are in public/javascripts
All my css files are in public/stylesheets
I can access the application.js file using the following link:
http://localhost:3000/javascripts/application.js?1424977675
What configuration change should I make, so that the following link works
http://localhost:3000/mydir/myapp/javascripts/application.js?1424977675
I have my application deployed in a subdirectory. Basically I have a docker and the application resides in mydir/myapp folder
I am not able to access the assets using
http://localhost:3000/mydir/myapp/javascripts/application.js?1424977675
How to I change the relative url for my assets to use http://localhost:3000/mydir/myapp/ instead of http://localhost:3000/
config.asset.prefix doesn't work
I also tried changing config.relative_url_root="/mydir/myapp" without any success
I've got a Rails site with a Jekyll blog incorporated, using the Bloggy gem.
I'd like a similar look for the main site and the blog, so I want to use the css in app/assets/stylesheets, but those files are in css.scss format. Jekyll (in a Bloggy setup) looks for css in config/jekyll/css, and seems to only want .css files; symlinking the Rails css directory into the Jekyll hierarchy doesn't seem to to work.
Is there a way to take advantage of the asset pipeline so that when I run jekyll:build, SCSS files from the Rails app are made into CSS files, placed in the appropriate jekyll directory, and bundled with the latest Jekyll build as it's placed into the /public/blog folder?
Thanks!
Ended up getting through this by:
Using the jekyll-sass gem to allow automatic transformation of the Rails app's .css.scss into .css.css files. By symlinking the Rails app/assets/stylesheets directory into Bloggy's config/jekyll/css, this put files with the right content but wrong extensions in the correct place.
Writing a rake task to make the .css.css files into .css files.
desc 'Make .css.css files into .css files'
task :css_css do
Dir.glob('public/blog/css/*.css.css').each do |file|
puts `mv #{file} #{file.gsub(/\.css\.css$/, '.css')}`
end
end
Not the prettiest solution, but it works.
#Matthew.. You have a nice solution.. For this part I did some stuffs manually. Like I added config/jekyll/css files as .css extension rather than .css.scss so when we run "rake generate" for bloggy the right format files are created on the folder public/blog/ rather css.scss.
I have made the changes in my bloggy portfolio theme project repository. If you are planning to use my version of code, I have did some changes like added robots.txt, sitemap, and integrated bootstrap to the project. I have also removed all database connections from the rails project since it was showing errors while deploying into heroku.
How can I link to an html file in the root directory of a rails app in ruby?
Hello
just /foo.html for your href, put the file in public folder of app.
I'm developing the web site using Aptana 2.04.
When i say "script/server" from the project folder, everything is ok
After copying the project folder to another place, and saying "script/server", server starts, but jammit does't loads the packaged assets and i see the web page without any css and js files loaded.
I played a little with this problem, and found following:
When i say "jammit" from the non-copied folder, it packages the assets.
When i say "jammit" from the copied folder, i get an error "Jammit Warning: No assets match" for each .js and .css file
Whats wrong here ?
Help !
Update 1
I refer to each asset in "assets.yml" in follwing way:
javascripts:
common:
- my_styles.css
my_styles.css are in "public/assets" folder.
I also tried "- public/assets/my_styles.css", but it does't work
Update 2
All works in production and development modes, when i starting the server from my project folder.
But, when i just copy the project folder to some other place, i get the jammit errors. Two folders are the same byte by byte, but the behaviour is different. This is what confuses me ...
Doesn't look like you're referring to your assets properly -- Jammit will cache packaged assets into the public/assets folder -- the files shouldn't be in there to start with. Here's an example directory structure and assets.yml for you:
Directories:
public
javascripts
script1.js
script2.js
script3.js
assets.yml:
javascripts:
common:
- public/javascripts/*.js
Hope that helps you out. In development, you should see all scripts included as individual tag, and in production, you should see a single assets/common.js file.
I have deployed my symfony app into a shared server. The problem: for example, the images and the .css of the default page that says
ok
Symfony Project Created
Congratulations! You have successfully created your symfony project.
Project setup successful
...
are not loaded.
I read this but it's not enough for me..
What should I do?
Regards
Javi
You may need to symlink from your web directory to the symfony data directory. In a standard Symfony install, with Symfony inside of your lib/vendor directory, it would look like this:
ln -s ../lib/vendor/symfony/data/web/sf/ sf
Alternatively, you can add an Alias for sf in your Apache config.