Giter Club home page Giter Club logo

angular-css-injector's Introduction

๐Ÿ‘‹ Hey there! I'm Gabriel

About me

๐Ÿ‘‹ Hi! I've been a freelance web developer since 2009. My experience includes working with large companies, a startup, a high-traffic website, and collaborating with teams located around the world. ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡จ๐Ÿ‡ฆ ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡ณ๐Ÿ‡ฑ ๐Ÿ‡ง๐Ÿ‡ช ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿ‡ธ๐Ÿ‡ฌ ๐Ÿ‡ฒ๐Ÿ‡บ

๐Ÿš€ I'm convinced we're entering a new Web era (details below). My journey alternates between self-education and paid freelance work.

โœจ Passionate about the Modern Web, I'm always eager to collaborate on innovative projects. If you're looking for an independent thinker with a knack for pushing the boundaries of web technology, let's connect!

My Current Focus

  • Offline SQL Databases for the Web (with Synchronization and Replication)
  • Embedded Small Language Models (SLMs)
  • Progressive Web Apps (PWAs) and the latest Web APIs
  • WebAssembly (WASM)
  • Native ES Modules (ESM), Importmaps, and HTTP/3
  • View Transitions API

Collaborating on Next-Gen Web Projects

I'm on the lookout for innovative projects that push the boundaries of the Modern Web. Looking for an independent thinker with a deep passion for web technology? Let's make something amazing together.

How to reach me

  • โœ‰๏ธ gabriel.delepine at gmail dot com
  • ๐Ÿค X (Twitter)

angular-css-injector's People

Contributors

blaues0cke avatar ebrentnelson avatar gabrieldelepine avatar lifter035 avatar ngehlert avatar petercrona1989 avatar timelf123 avatar trestoa 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  avatar  avatar

angular-css-injector's Issues

Question: Have you thought about supporting less file injection?

This is a function I use which assumes you have less.js loaded:

var $style = function(path, refresh, id){
if(_.isArray(path)) {
_.each(path,function(p){
load(p);
})
} else {
load(path);
}
function load(path){
var doc = document, head = doc.getElementsByTagName('head')[0], el = doc.createElement('link'),isLess=false;
el.type = "text/css";
el.href = path;
if(id){
el.id = id;
}
if(path.match(/.less/)) {
el.rel = "stylesheet/less";
isLess = true;
} else {
el.rel = "stylesheet"
}
head.lastChild.parentNode.insertBefore(el, head.lastChild.nextSibling);
if(isLess) {
less.sheets.push(el);
if(refresh){
less.refresh();
}
}
}
}

Fails if app is not declared on the HTML tag

I am not able to declare the Angular app on the HTML tag because I am injecting Angular into a Django Template. My app is defined on a DIV. Angular is quite happy to work this way, but this plugin will not work.

setSinglePageMode remove CSS files a little bit so early

Hi, (I open an issue to my own repository, because I don't have enough time this days to fix it by myself).

With angular-css-injector, set setSinglePageMode(TRUE) remove the CSS files added dynamically every time the view change.

With angular 1.0.8 I didn't find the way to remove the CSS files between the moment the view be loaded and the view be display.

I only find the way to remove the CSS files before the new view be loaded (event $locationChangeStart) and it's so early.
The second possibility is remove the CSS files after the new view be loaded and displayed (event $locationChangeSuccess) but in this case it's so late and I remove also the CSS files belong to the new view.

Does anyone know how to improve this behavior ? Maybe with the event $routeUpdate but in this case the reloadOnSearch property has been set to false (I don't know what does it mean, there is a little explanation here http://stackoverflow.com/a/14765954/2547632).

Doesn't work with custom $interpolationProvider

angular-css-injector doesn't work when tha app has the following config:

    .config(function($interpolateProvider) {
        $interpolateProvider.startSymbol('{[').endSymbol(']}');
    })

I see that the {{ }} interpolation is hardcoded. Need somehow to respect the app's config.

head.append($compile("<link data-ng-repeat='stylesheet in injectedStylesheets' data-ng-href='{{stylesheet.href}}' rel='stylesheet' />")(scope));

angular 1.2.3 only contains jqlite

CSS isn't re-injected after state change when single page mode is enabled

I'm working on a project that is using ui-router. I want to use css-injector for state specific views.

The injector successfully injects my css files when I first land on a page. However, if I navigate away and then back to a page, the css is no longer injected. A hard reload fixes the issue.

Has anyone dealt with a similar issue? Does anyone have any ideas on how to resolve this?

check version

Hi @GabrielDelepine ,
I want to add this library to cdnjs via send PR.
I found that the git tags show v1.4.0, but the angular-css-injector.js and angular-css-injector.min.js are both v1.0.4.
Please check the version, thank you.

cdnjs/cdnjs#7598

Requires scope of controller/app to be on html tag?

I'm trying to use this service in a module who's scope is limited to a specific widget on the page. Does that mean there's no way to create the scope() on head? The service script is failing with

var scope = angular.element("head").scope();

returning "undefined"

Support dynamic scripts

It would be nice not to limit functionality to stylesheets and to be able to add <script/> dynamically too

Make it a directive

Why not make it a directive so that stylesheet injection become declarative and not imperative in the controller?
Something like:

<ng-style src='css_from_current_module.css'><ng-style>

How to get the latest version using Bower?

I used bower install angular-css-injector and got version 1.0.3. I found it did not work when switching pages. I spent times on debugging it and later I found out that the code on Github is version 1.0.4. However, when I tried to get 1.0.4, I got an error "bower angular-css-injector#~1.0.4 ENORESTARGET No tag found that was able to satisfy ~1.0.4". Can you please let me know how to get version 1.0.4?

Your help is greatly appreciated.

Minified version in latest bower module not working

The minified version appears to be broken (for me at least). I am using Require.js with a project and it appears that when I am trying to use the minified version of cssInjector the following error is thrown:
Unknown provider: eProvider <- e <- cssInjector

However this is not the case when using the non-minified version. IMO it should be something trivial like changing the syntax to use the DI angular syntax and minify again. Cheers :)

Not compatible with Angular 1.3?

I can't get it to work with Angular's latest version. Bower makes me choose between the required 1.2.6 from this project, or use my current 1.3. Installs fine if I choose 1.3, but breaks my controllers just by injecting it into a module.
Is it really not compatible at this point?

Can you explain?

These last four lines? What are they doing?

        scope.stylesheets_service_dynamicStylesheets.push({href: href});
    };

    return {
        add: addStylesheet,
    };

Submit to Bower

Since this module is nice, why don't you include in package manager like Bower?

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.