Add timestamps to compiled sass/scss

后端 未结 2 589
星月不相逢
星月不相逢 2021-01-02 04:53

Is it possible to automatically add a timestamp on the compiled CSS file using SASS? e.g.

/* CSS Compiled on: {date+time} */
...compiled css goes here...
         


        
2条回答
  •  温柔的废话
    2021-01-02 05:50

    If you are using the command line version of SCSS you can do the following:

    1. Install sass-timestamp

      gem install sass-timestamp

    2. Use it within your code like (see documentation for more information)

      /* Compiled on #{timestamp()} */

    3. Require it on the command line

      scss -r sass-timestamp ...

    4. Output will be

      /* Compiled on 2015-02-02 13:01:40 +0800 */

    Note: Use #{unix_timestamp()} for a unix timestamp

提交回复
热议问题