grunt少多个css文件保持文件夹结构 [英] grunt less multiple css files keeping folder structure

查看:150
本文介绍了grunt少多个css文件保持文件夹结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个品牌应用程序,其中我想要有这个输出:

I have a branding application where I would like to have this output:


  • / branding /

    • / default /

      • default.css


      • brand1.css


      • brand2.css

      这个应该从一个具有相同结构但是带有.less文件的品牌文件夹输出

      This one should be output from a branding folder with same structure but with .less files

      所以我想做这样的事情:

      So I would like to do something like this:

      less: {
            production: {
              options: {
              },
              files: {
                'dist/branding/**/*.css': 'branding/**/*.less'
              }
            }
          }
      

      我刚刚看到的例子,他们都去同一个文件夹,但我想保持这种动态,因为在我的case有像一吨品牌,和品牌文件夹不仅仅是一个css文件,他们还有其他文物像图像等。
      任何建议?

      I just seen examples on this where they all go to same folder, but I want to keep this dynamic because in my case there is like a ton of brandings, and the branding folders have more than just a css file, they also have other artifacts like images and so on. Any suggestions?

      推荐答案

      如果我正确理解你,你希望LESS文件 / code>编译为 dist / branding 文件夹并保留文件夹结构。

      If I understand you correctly you want LESS files under branding compiled to a dist/branding folder and to keep the folder structure.

      你可以这样做:

      files: [
        {
          expand: true, // Recursive
          cwd: "branding", // The startup directory
          src: ["**/*.less"], // Source files
          dest: "dist/branding", // Destination
          ext: ".css" // File extension 
        }
      ]
      

      这篇关于grunt少多个css文件保持文件夹结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆