Coder Social home page Coder Social logo

Comments (7)

differui avatar differui commented on August 23, 2024

Hi @374632897 I added a test case (#32) for this issue.It looks like can't reproduce the bug.Maybe you can do adjustments and reproduce the bug.

from rollup-plugin-sass.

374632897 avatar 374632897 commented on August 23, 2024

@differui Thanks, but I still cannot get the compressed code use the way you offered in the test case.

const isProd = process.env.NODE_ENV === 'prod';

function compress(str) {
  return str.trim().replace(/[\n\r\s]/g, '').replace(/;}$/, '}');
}
export default {
  entry: 'src/index.vue',
  dest: 'dist/vue-emoji.js',
  format: 'umd',
  moduleName: 'VueEmoji',
  sourceMap: !isProd,
  plugins: [
    resolve({
      jsnext: true,
      main: true,
      browser: true
    }),
    vue(),
    sass({
      output (styles) {
        fs.writeFileSync('dist/vue-emoji.css', compress(styles));
      }
      // output: 'dist/vue-emoji.css',
      // options: {
      //   outputStyle: 'compressed',
      //   sourceMap: false
      // }
    }),
    babel({
      exclude: 'node_modules/**'
    }),
    commonjs(),
    (isProd && uglify())
  ]
}

By the way , I import *.scss files in .vue components, like this

<style lang = 'scss' scoped>
@import './emoji-sprite.scss';
<style>

Do this affect it ?

from rollup-plugin-sass.

differui avatar differui commented on August 23, 2024

@374632897 I think rollup-plugin-vue compiled everything in .vue files (scripts, styles and templates).Since as rollup-plugin-sass view there is no more @import style from 'path/to/style.scss' statement.

from rollup-plugin-sass.

374632897 avatar 374632897 commented on August 23, 2024

@differui 突然发现是一个地方的, 就直接用中文了。。。
image
最后出来的是这样。 都是未压缩的, 然后我这边试了一下, 如果要是使用的是从vue处理过的内容的话, 那么不会被压缩, 其他的则会被正常压缩, 所以我现在有点不大明白了, 到底是哪个地方的问题。 vue的话, 我是使用的rollup-plugin-vue。

from rollup-plugin-sass.

differui avatar differui commented on August 23, 2024

哈哈!我觉得如果你的项目都是 .vue 写的话直接用 rollup-plugin-vue 就可以了。这个里面也是用了 node-sass 编译 <style lang="sass"></style> 的内容。具体怎么配置要看下这个插件文档。

from rollup-plugin-sass.

differui avatar differui commented on August 23, 2024

@374632897 看看这个有没有用:https://github.com/vuejs/rollup-plugin-vue/blob/26b6b979198f7d6844617af5412576c51f347ccc/docs/en/2.3/README.md

from rollup-plugin-sass.

374632897 avatar 374632897 commented on August 23, 2024

@differui 真是太感谢了。 我在README和他提供的网站上都没有看到插件的使用说明,也没注意到目录里的docs o(╯□╰)o 😁

from rollup-plugin-sass.

Related Issues (20)

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.