Skip to content

Commit

Permalink
Bundle tailwind plugins
Browse files Browse the repository at this point in the history
Close #540
  • Loading branch information
leandrocp committed Jul 26, 2024
1 parent b0d8661 commit 4a83c5a
Show file tree
Hide file tree
Showing 15 changed files with 9,914 additions and 40 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ beacon-*.tar
/assets/node_modules
# tailwind.install
/assets/css/app.css
/assets/tailwind.config.js

# Dev temp files
/dev/
Expand Down
1 change: 1 addition & 0 deletions assets/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
printWidth: 120,
semi: false,
}
3 changes: 3 additions & 0 deletions assets/css/beacon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
16 changes: 8 additions & 8 deletions assets/js/beacon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
// 1. run `mix assets.build` to distribute updated static assets
// 2. phoenix js loaded from the host application

window.addEventListener('phx:beacon:page-updated', (e) => {
if (e.detail.hasOwnProperty('runtime_css_path')) {
document.getElementById('beacon-runtime-stylesheet').href = e.detail.runtime_css_path
window.addEventListener("phx:beacon:page-updated", (e) => {
if (e.detail.hasOwnProperty("runtime_css_path")) {
document.getElementById("beacon-runtime-stylesheet").href = e.detail.runtime_css_path
}

if (e.detail.hasOwnProperty('meta_tags')) {
if (e.detail.hasOwnProperty("meta_tags")) {
// remove current tags, except csrf-token
document.querySelectorAll("meta:not([name='csrf-token'])").forEach((el) => el.remove())

// create the new meta tags
e.detail.meta_tags.forEach((metaTag) => {
let newMetaTag = document.createElement('meta')
let newMetaTag = document.createElement("meta")

Object.keys(metaTag).forEach((key) => {
newMetaTag.setAttribute(key, metaTag[key])
})

document.getElementsByTagName('head')[0].appendChild(newMetaTag)
document.getElementsByTagName("head")[0].appendChild(newMetaTag)
})
}
})

let socketPath = document.querySelector('html').getAttribute('phx-socket') || '/live'
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute('content')
let socketPath = document.querySelector("html").getAttribute("phx-socket") || "/live"
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
let liveSocket = new LiveView.LiveSocket(socketPath, Phoenix.Socket, { params: { _csrf_token: csrfToken } })
liveSocket.connect()
window.liveSocket = liveSocket
14 changes: 0 additions & 14 deletions assets/js/editor/index.js

This file was deleted.

Loading

0 comments on commit 4a83c5a

Please sign in to comment.