markupguy

markupguy

Hey Everyone,

Having a whale of a time with getting my Shopify Phoenix app’s CSS to render.

Auth is sorted and the HTML renders fine, however, the entire document head is stripped out (and therefore the CSS with it).

I’ve added Content-Security-Policy frame-ancestors to allow https://.shopify.com https://.myshopify.com.

Shout out to @ericdude4 for making the setup pretty smooth with Shopifex :slight_smile: but now, the dang CSS!

Does anyone have an idea off the top of your head what could be going wrong?

Showing Posts 1 to 9

ericdude4

ericdude4

Hey @markupguy! This looks really strange… I don’t think it will have anything to do with the CSP headers. Can you include a link to a git repo which reproduces the error? Maybe just whatever code you have here, with your app’s API secret key removed?

PS. Love to see Shopifex getting used! I am hoping to spend some time refactoring the library in the new year and improving the documentation.

zachallaun

zachallaun

Also happily using Shopifex in an internal app for our store.

I’ve been using Shopify’s Polaris library for styling along with Phoenix components. Been working out pretty well! I’ll look into how I have CSS stuff set up later.

markupguy

markupguy OP

Thanks for the reply @zachallaun and @ericdude4 appreciate it! It really is quite strange.

But good to know this isn’t somehow expected, hah.

@ericdude4 it’s a super vanilla Phoenix app (just wanted to get it working first), with the Shopifex added bits. I’ve redone it a few times thinking I made a mistake somewhere. I can add you to the repo if you like, as it’s a private repo (doing a thing for a friend). Any and all help is welcome :smiley:

PS: Merry Christmas!

markupguy

markupguy OP

In a more confusing turn of events, when I force an error – the error page styles show just fine!

I notice these styles are embedded in the document head… but the head is not stripped out like mine is when the app doesn’t error. Weirdness.

ericdude4

ericdude4

Happy to take a look if you’d like to invite me to your repo?

Merry Christmas to you as well! :christmas_tree:

markupguy

markupguy OP

thanks @ericdude4 I’ve added you! I owe you one which I’ll figure out how to say thanks :slight_smile:

markupguy

markupguy OP

Everyone here, I just want to say @ericdude4 is an absolute legend, going way beyond what can sensibly be expected from anyone i.t.o helping a stranger.

His solution:

it turns out that new phoenix specifies the root layout in plug :put_root_layout, {MyappWeb.LayoutView, :root} which is in the :browser pipeline by default. Shopifex provides the :shopifex_browser pipeline which replicates the default :browser pipeline plus the plug(Shopifex.Plug.LoadInIframe) plug. This doesn’t include the newer :put_root_layout plug though, which is why your app wasn’t loading anything from lib/myapp_web/templates/layout/root.html.heex

(loadiniframe plug was my addition to remove x-frame-options which Eric has built in already)

sergio

sergio

Kudos for sharing the solution.

ericdude4

ericdude4

Happy to help! We will need an update to the Shopifex readme to recommend folks simply add the Shopifex.Plug.LoadInIframe to their existing browser pipeline instead of using :shopifex_browser

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews