← 输入框|github.com|刷新
Skip to content

Introduce a way to override Sprangular's manifest file #161

Open

Description

@simonwalsh

Hey!

At the moment, there is no real way to override this file from the host app: https://github.com/sprangular/sprangular/blob/master/app/assets/javascripts/sprangular/app.coffee

I would love to be able to do this as it would allow the host app to pick and chose what it wants to load in the code base. The only way right now to not load specific files from Sprangular in the host is by creating empty files, which is less than ideal.

My perfect plan would be to have this very same app.coffee file in the gem like it is now, but still be able to have a app.coffee in the host that will be tailored to the app's needs.

When I try doing this now, there is no way I can reference the gem's file structure and the asset pipeline will try to look in the host app and evidently not find the required files.

Thoughts?

Activity

  1. simonwalsh commented on May 19, 2015

    @simonwalsh
    ContributorAuthor

    @joshnuss @bryanmtl @braidn any thoughts ?

  2. DanielWright commented on May 19, 2015

    @DanielWright

    Have you considered organizing the various elements of the application into submodules? Either role-specific (ie. catalog vs. account vs. checkout) or architecturally (ie. controllers vs. models vs. services). Then the host apps could define their angular models thus:

    window.HostApp = angular.module('HostApp', ['Sprangular.catalog', 'Sprangular.account', 'Sprangular.checkout']);
    

    Host apps would then be able to choose whether to use Sprangular's in-built modules, extend/overwrite them, or go BYO.

  3. braidn commented on May 19, 2015

    @braidn

    It is hard because the way Sprangular "does a lot" and sprockets is pretty dumb compared to something like Webpack/JSPM. Is there any thought of a big olé generator of sorts. Much like Ember Rails?

    https://github.com/emberjs/ember-rails/tree/master/lib/generators/templates

    Although, I wonder if there is a way to do it through Angular's module "injection" like mentioned by DW?

  4. DanielWright commented on May 19, 2015

    @DanielWright

    Yeah, my solution only addresses giving host apps some flexibility in terms of substituting their own components. Reducing the number of files being delivered by the AP is whole other kettle of fish.

  5. simonwalsh commented on May 19, 2015

    @simonwalsh
    ContributorAuthor

    @DanielWright Actually had not though of doing it that way. That would be a good idea. I will backburn this for a while but it would be super interesting to do it this way. Thanks guys for the brainstorm.

  6. self-assigned this
    on May 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions