Giter VIP home page Giter VIP logo

ember-cli-inline-content's Introduction

ember-cli-inline-content's People

Contributors

gpoitch avatar hem-brahmbhatt avatar spruce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ember-cli-inline-content's Issues

Cannot set property 'fromString' of undefined

We're trying to deploy to Heroku and for some reason we keep getting this error. Everything builds into dist fine locally and runs locally.

BuildingBuilding.Build failed.
Cannot set property 'fromString' of undefined
TypeError: Cannot set property 'fromString' of undefined

We've tried clearing the Heroku cache but still nothing.

The only thing we're using inlineContent for is this:

var app = new EmberApp({
  inlineContent: {
    'analytics' : {
      file: './analytics.js',
      postProcess: function(content) {
        return content.replace(/\{\{SEGMENT_KEY\}\}/g, config.segmentKey);
      }
    }
  }
});

it was working fine before we upgraded to ember-cli 0.2.2

The full stacktrace given to us by Heroku is as follows:

       TypeError: Cannot set property 'fromString' of undefined
           at InlineContentRenderer.renderScript (/tmp/build_cf0dd66cf1a6dce9411922de861dbcca/node_modules/ember-cli-inline-content/index.js:81:30)
           at InlineContentRenderer.contentFor (/tmp/build_cf0dd66cf1a6dce9411922de861dbcca/node_modules/ember-cli-inline-content/index.js:41:23)
           at /tmp/build_cf0dd66cf1a6dce9411922de861dbcca/node_modules/ember-cli/lib/broccoli/ember-app.js:1249:49
           at Array.reduce (native)
           at EmberApp.contentFor (/tmp/build_cf0dd66cf1a6dce9411922de861dbcca/node_modules/ember-cli/lib/broccoli/ember-app.js:1248:33)
           at replacement (/tmp/build_cf0dd66cf1a6dce9411922de861dbcca/node_modules/ember-cli/lib/broccoli/broccoli-config-replace.js:68:36)
           at String.replace (native)
           at CustomReplace.processFile (/tmp/build_cf0dd66cf1a6dce9411922de861dbcca/node_modules/ember-cli/lib/broccoli/broccoli-config-replace.js:72:25)
           at CustomReplace.process (/tmp/build_cf0dd66cf1a6dce9411922de861dbcca/node_modules/ember-cli/lib/broccoli/broccoli-config-replace.js:52:10)
           at lib$rsvp$$internal$$tryCatch (/tmp/build_cf0dd66cf1a6dce9411922de861dbcca/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:489:16)

Thanks for taking the time to look at this!

Add ability to vary inline content depends of route.

For example, I have router.js:

import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('user', function() {
    this.route('register');
    this.route('login');
  });
});

export default Router;

Then I want custom attributes.

I did in app/index.html like that:

In ember-cli-build.js I did something like:

inlineContent: {
      'body_styles': {
        content: "skin-blue sidebar-mini"
      }
    }

But I want to vary body_styles replacement string depend of application route. For example, for route user/register I need:

      'body_styles': {
        content: "register_page"
      }

etc, etc. How can I do that? Thanks.

Cannot find module 'uglify-js'

Just reporting this, great addon btw :)

version: 0.1.1
Cannot find module 'uglify-js'
Error: Cannot find module 'uglify-js'
at Function.Module._resolveFilename (module.js:331:15)
at Function.Module._load (module.js:273:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object. (/var/www/marcemira/node_modules/ember-cli-inline-content/index.js:3:16)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:349:32)
at Function.Module._load (module.js:305:12)
at Module.require (module.js:357:17)
at require (module.js:373:17)

Adding custom thirdparty scripts, e.g. <script src=".."

Moved from #3

Would love being able to add scripts with a src, where the script isn't processed, without having to write HTML markup, with the ability to add query params.

inlineContent: {
  'gmaps-api': {
    url: '//maps.googleapis.com/maps/api/js',
    params: {
      v: '3.exp',
      libraries: ['drawing', 'geometry'].join(',')
    }
  }
}

Then you can change the version to stable in production, and add a clientId or an apikey.

Also supporting 'gmaps-api': '[http:|https:|etc]//maps.googleapis.com/maps/api/js' where a check is performed if it's a path or a url, if url set as src, otherwise put inside.

How to reference built assets?

The assets now have paths like:

  <link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
  <link rel="stylesheet" href="{{rootURL}}assets/website.css">

How can I reference these with this addon to inline them?

Accessing config from environment.js

I'm struggling to access configuration set in environment.js from the Brocfile.js.

I'm not sure if there's a way to do it. I think by the time the environment.js is loaded, the Brocfile.js has already loaded and created the new Ember app.

The addon may have access to config by the time it inlines content on the page. Maybe it could pick up config and insert it. For example:

//myScript.js
console.log('{{signOutUrl'}});
//Brocfile.js
inlineContent: {
  file: 'myScript.js'
  replace: 'signOutUrl'
//environment.js
if (environment === 'development') { ENV.signOutUrl: 'signout.com' }

Allow empty string to be rendered

In this example (https://github.com/gdub22/ember-cli-inline-content#rendering-a-string-of-content-instead-of-a-file), when you attempt to add empty string '' as content, you get this error.

Path must be a string. Received { content: '' }
TypeError: Path must be a string. Received { content: '' }
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at InlineContentRenderer.readFile (/Users/jasonkim/work/node/webclient-cli/node_modules/ember-cli-inline-content/index.js:68:23)
    at InlineContentRenderer.contentFor (/Users/jasonkim/work/node/webclient-cli/node_modules/ember-cli-inline-content/index.js:43:22)
    at /Users/jasonkim/work/node/webclient-cli/node_modules/ember-cli/lib/broccoli/ember-app.js:1539:49
    at Array.reduce (native)
    at EmberApp.contentFor (/Users/jasonkim/work/node/webclient-cli/node_modules/ember-cli/lib/broccoli/ember-app.js:1538:33)
    at replacement (/Users/jasonkim/work/node/webclient-cli/node_modules/broccoli-config-replace/index.js:86:36)
    at RegExp.[Symbol.replace] (native)
    at RegExp.[Symbol.replace] (native)

I think this is intended. We should be able to render empty string if we want to.

recompile and reload page in dev mode

i made a inline/ directory for inline template files,

now ,once template files changed, can't reload ;
i can mv inline/ to app/, once reload is ok ,but the content is old ;

so, is it possible to implement this feature ?

thanks for all mind .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.