Giter Site home page Giter Site logo

Comments (9)

twinstony avatar twinstony commented on June 2, 2024

同问,该如何处理依赖的css?如何配置才能生成如下格式的js:

define("alice/tipbox/1.0.0/tipbox-debug.css", [], function() {
    function importStyle(cssText) {
        var element = document.createElement("style");
        doc.getElementsByTagName("head")[0].appendChild(element);
        if (element.styleSheet) {
            element.styleSheet.cssText = cssText;
        } else {
            element.appendChild(doc.createTextNode(cssText));
        }
    }
    importStyle(".ui-tipbox{position:relative;zoom:1;font-size:12px}.ui-tipbox .ui-tipbox-icon{background:#fff;width:20px;height:20px;position:absolute;top:20px;left:46px}.ui-tipbox-icon .iconfont{font-size:32px;position:absolute;top:-4px;left:-6px;width:32px;height:32px;line-height:34px;text-shadow:1px 1px 0 #fff}.ui-tipbox-message{border:1px solid #CBD7E2;background:#E4F5FE}.ui-tipbox-message .ui-tipbox-icon .iconfont{color:#0483CF}.ui-tipbox-success{border:1px solid #E1E1CA;background:#EDFED0}.ui-tipbox-success .ui-tipbox-icon .iconfont{color:#20DC19}.ui-tipbox-error{background:#FDEEE9;border:1px solid #F6C7B8}.ui-tipbox-error .ui-tipbox-icon .iconfont{color:#FF4800}.ui-tipbox-warning{background:#FEFEA4;border:1px solid #E6C46A}.ui-tipbox-warning .ui-tipbox-icon .iconfont{color:#FFA700}.ui-tipbox-question{border:1px solid #CBD7E2;background:#E4F5FE}.ui-tipbox-question .ui-tipbox-icon .iconfont{color:#00B5F3}.ui-tipbox-stop{background:#FDEEE9;border:1px solid #F4C7B5}.ui-tipbox-stop .ui-tipbox-icon .iconfont{color:#F50}.ui-tipbox-wait{border:1px solid #E6CBB1;background:#FFF9D9}.ui-tipbox-wait .ui-tipbox-icon .iconfont{color:#B26100}.ui-tipbox-content{margin:14px 0 14px 87px}.ui-tipbox-content .ui-tipbox-title{margin:0;padding:0}.ui-tipbox-content h3.ui-tipbox-title,.ui-tipbox-content-simple h3.ui-tipbox-title{color:#333;font-size:14px;font-weight:700}.ui-tipbox-content-simple{margin:22px 0 22px 88px}.ui-tipbox-explain{margin:0;padding:0;color:gray}.ui-tipbox-white{background:#fff;border:1px solid transparent;_border-color:tomato;_filter:chroma(color=tomato)}");
});

from grunt-cmd-transport.

popomore avatar popomore commented on June 2, 2024

@crystalNB

var style = require('grunt-cmd-transport').style

from grunt-cmd-transport.

popomore avatar popomore commented on June 2, 2024

@twinstony 可以看看这个例子

https://github.com/spmjs/grunt-cmd-transport/tree/master/examples/css2js

from grunt-cmd-transport.

hpl934n avatar hpl934n commented on June 2, 2024

同问上面设置css的parsers问题, popomore给的例子已经不存在了

from grunt-cmd-transport.

popomore avatar popomore commented on June 2, 2024

移到 test 里了

https://github.com/spmjs/grunt-cmd-transport/tree/master/test/cases/css2js

from grunt-cmd-transport.

hpl934n avatar hpl934n commented on June 2, 2024

产生的还是 seajs.importStyle("……")这样样式的,在页面导入时报找不到importStyle的方法。求解

from grunt-cmd-transport.

popomore avatar popomore commented on June 2, 2024

有个插件 https://github.com/seajs/seajs-style

from grunt-cmd-transport.

hpl934n avatar hpl934n commented on June 2, 2024

在上面的例子中,产生的是 seajs.importStyle("……")css引用样式,在页面中会报找不到importStyle方法的错误。求解

from grunt-cmd-transport.

hpl934n avatar hpl934n commented on June 2, 2024

嗯,看到这个插件了。谢谢 popomore

from grunt-cmd-transport.

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.