Coder Social home page Coder Social logo

feature suggestion about stss HOT 4 CLOSED

ronaldtreur avatar ronaldtreur commented on August 29, 2024
feature suggestion

from stss.

Comments (4)

winsonet avatar winsonet commented on August 29, 2024

and I have enhanced the stss file's input and output folder, I think it better put all stss file into another folder (like lib) in the style folder, so my folder structure is:

app
----styles
----------lib
------------view.stss

or with platform

app
----styles
--------ios
----------lib
------------view.stss

after that, it will generate the tss file into the normal styles folder. I just changed the alloy.jmk file and for you reference:

var platform = config.alloyConfig.platform,
        platformDir = platform === 'ios' ? 'iphone' : config.alloyConfig.platform,
        srcDirs = [
            config.dir.styles + '/lib', //add the lib folder
            path.join(config.dir.styles + '/lib', platformDir)  //add the lib folder
        ],
        files;

    srcDirs.forEach(function(dir) {
        if (fs.existsSync(dir)) {
            files = fs.readdirSync(dir);
            files.forEach(function(file) {
                var inFile = path.join(dir, file),
                    outFile;

                if (/\.stss$/.test(file) && fs.statSync(inFile).isFile()) {
                    var outFileFolder = path.dirname(inFile);
                    //get the normal output folder
                    outFileFolder = outFileFolder.substring(0, outFileFolder.length - 4);
                    outFile = path.join(outFileFolder, path.basename(inFile, '.stss') + '.tss');
                    logger.info('Rendering STSS ' + file + ' to '+ outFile);

                    // Convert STSS to TSS
                    renderer.renderSync({
                        file: inFile,
                        outFile: outFile,
                        error: function(err) {
                            if (err.title && err.line) {
                                logger.error('STSS: ' + err.title);
                                logger.error('');
                                logger.error(err.line);
                                logger.error('');
                                logger.error(err.processed);
                            } else {
                                logger.error(err.message);
                            }
                            err = {message: 'Error STSS conversion failed', toString: function() {return this.message;}};
                            throw (err);
                        }
                    });
                }
            });
        }
    });

from stss.

rtuin avatar rtuin commented on August 29, 2024

@winsonet you might want to check out this blogpost on TiDev.io regarding calculations and expressions in tss/stss: http://www.tidev.io/2014/10/22/how-to-use-expressions-in-tss/

from stss.

RonaldTreur avatar RonaldTreur commented on August 29, 2024

@winsonet Sorry for the (very!) late reply, but the article @rtuin's referred to seems to be the only valid approach to do this.

STSS has no knowledge about values you declared in your alloy.js. And even if it would (which will never happen) that would not be enough, since you are simply assigning another constant to your global property. One which we also don't know the value of during compilation of the STSS data.

So I'm closing this for now.

from stss.

winsonet avatar winsonet commented on August 29, 2024

I see, thanks for your reply!

from stss.

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.