TrevorHinesley

TrevorHinesley

Hi everyone!

I’m a long-time Rails programmer and have been dabbling in Elixir/Phoenix. Loving it!

I just downloaded the Argon dashboard by Creative Tim and am trying to get it hooked up a new Phoenix application. Here’s where I’m stuck… following the Quick Start docs, I’ve moved a bunch of their files into my assets directory. Here’s the structure:

assets
  -> css
    -> theme
      -> bootstrap
      -> core
      -> custom
      -> argon.scss
    -> app.scss
    -> phoenix.scss
  -> js
    -> theme
      -> argon.min.js
    -> app.js
    -> socket.js
  -> node_modules
  -> static
  -> vendor
    -> @fortawesome
    -> anchor-js
    ... etc ...

In the assets/vendor folder, I’ve put everything from the dashboard’s own vendor folder, and removed anything wasn’t a compiled/bundled/minified js/css file.

I’m trying to use brunch’s config to specify the order of some files, but it’s not working properly. Here’s my config:

exports.config = {
  // See http://brunch.io/#documentation for docs.
  files: {
    javascripts: {
      joinTo: "js/app.js",

      // To use a separate vendor.js bundle, specify two files path
      // http://brunch.io/docs/config#-files-
      // joinTo: {
      //   "js/app.js": /^js/,
      //   "js/vendor.js": /^(?!js)/
      // }
      //
      // To change the order of concatenation of files, explicitly mention here
      order: {
        before: [
          "vendor/jquery/dist/jquery.min.js",
          "vendor/bootstrap/dist/js/bootstrap.bundle.min.js",
          "js/theme/argon.min.js",
        ],
        after: [
          "js/app.js",
        ],
      }
    },
    stylesheets: {
      joinTo: "css/app.css",

      order: {
        before: [
          "vendor/nucleo/css/nucleo.min.css",
          "vendor/@fortawesome/fontawesome-free/css/all.min.css",
          "css/theme/argon.scss",
        ],
        after: [
          "css/app.scss",
        ],
      }
    },
    templates: {
      joinTo: "js/app.js"
    }
  },

  conventions: {
    // This option sets where we should place non-css and non-js assets in.
    // By default, we set this to "/assets/static". Files in this directory
    // will be copied to `paths.public`, which is "priv/static" by default.
    assets: /^(static)/
  },

  // Phoenix paths configuration
  paths: {
    // Dependencies and current project directories to watch
    watched: ["static", "css", "js", "vendor"],
    // Where to compile files to
    public: "../priv/static"
  },

  // Configure your plugins
  plugins: {
    babel: {
      // Do not use ES6 compiler in vendor code
      ignore: [/vendor/]
    },
    sass: {
      mode: "native", // set to 'native' to force libsass
      options: {
        precision: 8 // Minimum precision required by bootstrap
      }
    }
  },

  modules: {
    autoRequire: {
      "js/app.js": ["js/app"]
    }
  },

  npm: {
    enabled: true
  }
};

The problem is, the js before/after options don’t seem to be working, or at least vendor files are ALWAYS after everything. If I look at the app.js.map that’s bundled by brunch, here’s the sources array:

"sources":["js/theme/argon.min.js","node_modules/phoenix/priv/static/phoenix.js","node_modules/phoenix_html/priv/static/phoenix_html.js","js/socket.js","js/app.js","vendor/jquery/dist/jquery.min.js","vendor/bootstrap/dist/js/bootstrap.bundle.min.js","vendor/@fortawesome/fontawesome-free/js/all.min.js","vendor/@fortawesome/fontawesome-free/js/brands.min.js","vendor/@fortawesome/fontawesome-free/js/fontawesome.min.js","vendor/@fortawesome/fontawesome-free/js/regular.min.js","vendor/@fortawesome/fontawesome-free/js/solid.min.js","vendor/@fortawesome/fontawesome-free/js/v4-shims.min.js","vendor/anchor-js/anchor.min.js","vendor/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js","vendor/chart.js/dist/Chart.bundle.min.js","vendor/clipboard/dist/clipboard.min.js","vendor/headroom.js/dist/jQuery.headroom.min.js","vendor/holderjs/holder.min.js","vendor/jquery-scroll-lock/dist/jquery-scrollLock.min.js","vendor/jquery.scrollbar/jquery.scrollbar.min.js","vendor/nouislider/distribute/nouislider.min.js","vendor/onscreen/dist/on-screen.umd.min.js"]

As you can see, js/app.js is NOT after everything else (at least not after vendor files).

Any ideas what’s going on here? I’ve already checked out this template porting discussion.

Thanks for any help!

Showing Posts 1 to 3

TrevorHinesley

TrevorHinesley OP

I actually think this might be a problem with Brunch. Added an issue here: Map sources are ordered incorrectly · Issue #1830 · brunch/brunch · GitHub

Nicd

Nicd

As Brunch development is sparse and Phoenix is moving to Webpack in the next version, you may also want to look that way.

TrevorHinesley

TrevorHinesley OP

Did notttt know that. Good plan. Thanks!

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
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
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
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
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
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

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
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews