grunt-inline icon indicating copy to clipboard operation
grunt-inline copied to clipboard

dont work for .hbs

Open Anisotropic opened this issue 10 years ago • 6 comments

Hello. i've tried to use this plugin for inlining CSS for handlebars templates, but it don't work. Handlebars templates - are HTML parts without

. Maybe this cause the trouble?

Anisotropic avatar Jul 18 '14 10:07 Anisotropic

@Anisotropic any more details? Like error message printed? Try options.exts like bellow it may wokrs.

        dist: {
            options: {
                exts: ['hbs']
            },
            src: ['src/**/*.hbs']
        }

If it still doesn't work, please let me know :)

chyingp avatar Jul 20 '14 09:07 chyingp

Yes, it's still doesn't work.
Using this syntax not working:

        inline: {
            all:{
                    options:{
                        cssmin: true,
                        exts: ['hbs']
                    },
                    src: ['app/handlebars/standart.hbs'],
                    dest: ['.tmp/']
                }
              },

And this syntax not working:

    inline: {
            all:{
                    options:{
                        cssmin: true
                    },
                    src: ['app/handlebars/standart.hbs'],
                    dest: ['.tmp/'],
                     ext: '.hbs'
                }
              },

it copying hbs file without inlining. .hbs begin with this: `

.....`

Anisotropic avatar Jul 21 '14 07:07 Anisotropic

@Anisotropic there should be a __inline tag to tell grunt-inline that this stylesheet needs to be inlined , as the documentation says. Follow the example bellow, just try again :)

<link href="css/style.css?__inline=true" rel="stylesheet" />

chyingp avatar Jul 21 '14 16:07 chyingp

yes, my mistake. When i add this __inline tag, example from my past message are working. But this one:

inline: {
            all:{
                files: [{
                        expand: true,
                        cwd: 'app/handlebars/',
                        src: ['*.hbs'],
                        dest: '.tmp/handlebars/',
                        ext: '.hbs'
                    }],
                    options:{
                        cssmin: true,
                        exts: ['hbs']
                    },
                }
              },

Working as i'm no expect. It inlining all hbs files in /app/handlebars/, but i want it inlined in /.tmp/handlebars/

Anisotropic avatar Jul 22 '14 08:07 Anisotropic

@Anisotropic I had the same problem with .ejs views. You solution works for me with .ejs.

Did you manage to inlined in the 'dest' folder ? Any solutions?

ghost avatar Oct 24 '14 10:10 ghost

@maxime-crunding I`ve solved this by using another inline plugin and divide this one action to some independent actions: 1 - copy .hbs to .tmp, 2 - copy & minifying .css to .tmp, 3 - inlining .css to .hbs, 4 - compiling & uglifying .hbs

Anisotropic avatar Oct 27 '14 08:10 Anisotropic