GithubHelp home page GithubHelp logo

Comments (7)

afc163 avatar afc163 commented on June 10, 2024

https://github.com/aliceui/example/blob/spm2/dist/function-debug.js

from grunt-cmd-concat.

twinstony avatar twinstony commented on June 10, 2024

请问这种模块是如何生成的?是transport还是spm1?

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-concat.

afc163 avatar afc163 commented on June 10, 2024

grunt-cmd-transport 中有相关功能。

https://github.com/spmjs/grunt-cmd-transport/blob/master/tasks/lib/style.js#L106

现在是打成 seajs.importStyle('') 的方式。

from grunt-cmd-concat.

twinstony avatar twinstony commented on June 10, 2024

@afc163
请问该如何配置transport才能生成这种css?
目前我生成的css文件,都只是普通的css,并未包含seajs.importStyle('') 的方式。

from grunt-cmd-concat.

lepture avatar lepture commented on June 10, 2024

@twinstony https://github.com/spmjs/grunt-cmd-concat#optionscss2js

from grunt-cmd-concat.

twinstony avatar twinstony commented on June 10, 2024

这样设置,会错误的寻找.css.js文件。
Grunt.js头部:

module.exports = function (grunt) {
    var style = require('grunt-cmd-transport').style.init(grunt);

    grunt.initConfig({
        ...
    })

concat:

concat: {
            options: {
                include: 'all',
                paths: ['.']
            },
            dialog: {
                options: {
                    include: 'relative',
                    css2js: style.css2js
                },
                files: {
                    "dist/styles/component/dialog/src/dialog-debug.js": ["tmp/styles/component/dialog/src/dialog-debug.js"]
                }
            }
        }

log:

Running "concat:dialog" (concat) task
>> file tmp/styles/component/dialog/src/dialog_css-debug.css.js not found

dialog-debug.js:

define("eju/gruntTest/0.0.1/styles/component/dialog/src/dialog-debug", [ "/gallery/jquery/1.8.2/jquery-debug", "./dialog_css-debug.css" ], function(require, exports, module) {
    var $ = require("/gallery/jquery/1.8.2/jquery-debug");
    require("./dialog_css-debug.css");
    ....
})

from grunt-cmd-concat.

edokeh avatar edokeh commented on June 10, 2024

@twinstony
可以先看看我这个 https://github.com/edokeh/spm2-example 了解一下
但是我这个例子还不适合用于生产环境,只是一个非常初级阶段的用法,需要做很多进一步的封装

from grunt-cmd-concat.

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.