Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icons in dynamic DOM #144

Closed
dominikwilkowski opened this issue Oct 23, 2015 · 8 comments
Closed

Icons in dynamic DOM #144

dominikwilkowski opened this issue Oct 23, 2015 · 8 comments
Assignees

Comments

@dominikwilkowski
Copy link
Member

@dominikwilkowski dominikwilkowski commented Oct 23, 2015

How to run grunticon in an SPA?

This issue is linked with filamentgroup/grunticon#258 and still open.
Until grunticon has this issue open let me suggest some way to get this to work for now:

Angular solution 1

(function guiGrunticonsEmbedDirective() {
    'use strict';
    var componentsModule = angular.module('gui.ng.components.grunticonEmbed', []);
    componentsModule.directive('grunticonEmbed', grunticonEmbed);

    function grunticonEmbed() {
        var directive = {
            restrict: 'A',
            scope: false,
            link: linkFunc
        };

        return directive;

        function linkFunc() {
            grunticon.embedIcons(grunticon.getIcons(grunticon.getCSS(grunticon.href)));
        }
    }
})();

Angular solution 2

https://gist.github.com/navad/c6da12424ef9bc573700 (not sure about that one)

If you have more let us know.

@dominikwilkowski
Copy link
Member Author

@dominikwilkowski dominikwilkowski commented Oct 23, 2015

There is also a cool way to change the color by using -webkit-mask-image in CSS. This also should be an option to be considered here.

@navad
Copy link

@navad navad commented Oct 26, 2015

Gist updated with our latest version (more in the comments section)

@dominikwilkowski
Copy link
Member Author

@dominikwilkowski dominikwilkowski commented Oct 26, 2015

nice work @navad
looks great

@dominikwilkowski
Copy link
Member Author

@dominikwilkowski dominikwilkowski commented Nov 9, 2015

There is effort in writing an angular GUI which is also tackling the same issue.
For reference see more here: WestpacCXTeam/Angular-GUI#1

@dominikwilkowski
Copy link
Member Author

@dominikwilkowski dominikwilkowski commented Jan 20, 2016

Just for future references, this is the unminified version of the loader script for grunticon:
https://github.com/filamentgroup/grunticon-lib/blob/master/static/grunticon.loader.js

@dominikwilkowski
Copy link
Member Author

@dominikwilkowski dominikwilkowski commented Mar 18, 2016

Just an FYI:
A new proposed svg system will be implemented soonish. Please have a look and submit any concerns. We expect it to solve this issue.

#209

@dominikwilkowski
Copy link
Member Author

@dominikwilkowski dominikwilkowski commented Sep 7, 2016

Closing due to the fact that we already have a working directive for Angular and are also moving away from grunticon via #209

@codebymark
Copy link

@codebymark codebymark commented Jul 19, 2019

For anyone else that is looking for a solution for Angular (Tested on v6), I had to create this to get this to work: https://gist.github.com/markhbucknell/19edab47bac1fa3bda4a2cbc65b584b9

I still had to style like this

.icon.icon-info svg path
  fill: #0074c4

This is a bit of a quick solution, there may be something better out there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants