Giter Club home page Giter Club logo

Comments (5)

princed avatar princed commented on September 24, 2024

Could you please show more of your Gruntfile?

from postcss-banner.

jaredrethman avatar jaredrethman commented on September 24, 2024

Wow, thanks for getting back to me so quickly. Here is my full PostCSS Grunt task.

 var autoprefixer = require('autoprefixer-core'),
      cssURLs = require('postcss-url'),
      cssBanner = require('postcss-banner');

      postcss: {
            build:{
                options: {
                    map: false,
                    processors: [
                        cssBanner({
                            banner: ' \n' +
                                    'Theme Name: Theme Name \n' +
                                    'Version: <%= pkg.version %> \n' +
                                    'Theme URI: http://mydomain.com\n' +
                                    'Author: <%= pkg.author %> \n' +
                                    'Author URI: https://mydomain.com\n' +
                                    'Description: <%= pkg.description %> \n' +
                                    'Text domain: <%= pkg.name %>\n'
                        })
                    ]
                },
                src: 'style.css',
                dest: 'style.css'
            },
            dev: {
                options: {
                    map: false,
                    processors: [
                        cssURLs({
                            url :"rebase"
                        })
                    ]
                },
                src: '<%= project.css %>dev.css',
                dest: '<%= project.css %>dev.css'
            },
            dist: {
                options: {
                    map: true,
                    processors: [
                        autoprefixer({
                            browsers: ['> 0.5%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']
                        }), // add vendor prefixes
                        cssURLs({
                            url :"rebase"
                        })
                    ]
                },
                src: '<%= project.css %><%= project.app %>.min.css',
                dest: '<%= project.dist %><%= project.app %>.min.css'
            }
        },

Let me know if you need more?

from postcss-banner.

princed avatar princed commented on September 24, 2024

grunt isn't able to replace variables in function arguments (like cssBanner).
Possible workaround is to use simple concatenation instead:

var pkg = require('./package.json');
...
      pkg: pkg,
      postcss: {
            build:{
                options: {
                    map: false,
                    processors: [
                        cssBanner({
                            banner: ' \n' +
                                    'Theme Name: Theme Name \n' +
                                    'Version: ' + pkg.version + '\n' +
...

from postcss-banner.

jaredrethman avatar jaredrethman commented on September 24, 2024

@princed thanks for your help, it worked and thanks for helping me better understand Grunt :)

from postcss-banner.

princed avatar princed commented on September 24, 2024

You're welcome :)

from postcss-banner.

Related Issues (7)

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.