photoswipe-rails icon indicating copy to clipboard operation
photoswipe-rails copied to clipboard

Using @import to load photoswipe CSS

Open kelso opened this issue 7 years ago • 4 comments

I am using application.scss where I put @import. Like:

@import "bootstrap";
@import "photoswipe.css";

When I ommit ".css" in "photoswipe.css" (as README says) in development mode I get error:

File to import not found or unreadable: photoswipe.
Load paths:
  /Users/stefanhuska/Code/huska-photos/app/assets/config
  /Users/stefanhuska/Code/huska-photos/app/assets/images
  /Users/stefanhuska/Code/huska-photos/app/assets/javascripts
  /Users/stefanhuska/Code/huska-photos/app/assets/stylesheets
  /Users/stefanhuska/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/photoswipe-rails-4.1.2/app/assets/images
  /Users/stefanhuska/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/photoswipe-rails-4.1.2/app/assets/javascripts
  /Users/stefanhuska/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/photoswipe-rails-4.1.2/app/assets/stylesheets
  /Users/stefanhuska/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/jquery-rails-4.3.1/vendor/assets/javascripts
  /Users/stefanhuska/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/coffee-rails-4.2.2/lib/assets/javascripts
  /Users/stefanhuska/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actioncable-5.1.4/lib/assets/compiled
  /Users/stefanhuska/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionview-5.1.4/lib/assets/compiled
  /Users/stefanhuska/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/turbolinks-source-5.0.3/lib/assets/javascripts

So I added ".css" to @import, but in production mode it doesn't work either :/ Browser JS console shows:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://<mydomain>/assets/photoswipe.css

What I am doing wrong? Thanks for any help.

kelso avatar Oct 23 '17 15:10 kelso

Hello !

I've exactly the same problem, did you find a solution ?

Thanks a lot !

jeangus avatar Nov 20 '17 16:11 jeangus

Same here

MatthieuBarthel avatar Jan 10 '18 17:01 MatthieuBarthel

I just found an easy solution :

@import "photoswipe/photoswipe"
@import "photoswipe/default-skin/default-skin"

MatthieuBarthel avatar Jan 10 '18 17:01 MatthieuBarthel

@MatthieuBarthel solution works :+1: (big thanks, also to @kelso for asking it) .

Although that's Sass solution. To be complete the Scss solution is:

@import "photoswipe/photoswipe";
@import "photoswipe/default-skin/default-skin";

small detail, but just to be complete ;)

update provided README update https://github.com/skakri/photoswipe-rails/pull/12 as this is bit painful to figure out

equivalent avatar Sep 29 '21 21:09 equivalent